Bài đăng

Đang hiển thị bài đăng từ Tháng 8, 2017

2.5. Variable Names and Keywords

Variable names  can be arbitrarily long. They can contain both letters and digits, but they have to begin with a letter or an underscore. Although it is legal to use uppercase letters, by convention we don’t. If you do, remember that case matters.  Bruce  and  bruce  are different variables. Tên của biến có thể có độ dài tùy ý. Chúng có thể chứa cả các chữ cái và số, nhưng chúng phải bắt đầu bằng một chữ cái hoặc dấu gạch chân. Mặc dù nó có thể sử dụng các chữ cái (in) hoa, nhưng quy ước là chúng ta không (sử dụng). Nếu bạn làm điều đó, hãy nhớ trường hợp Bruce và bruce là các biến khác nhau. Caution Variable names can never contain spaces. Cảnh báo: tên biến không bao giờ chứa dấu cách. The underscore character (  _ ) can also appear in a name. It is often used in names with multiple words, such as  my_name  or  price_of_tea_in_china . There are some situations in which names beginning with an underscore have special meaning,...

2.2. Values and Data Types

A  value  is one of the fundamental things — like a word or a number — that a program manipulates. The values we have seen so far are  5  (the result when we added  2   +   3 ), and  "Hello,   World!" . We often refer to these values as  objects  and we will use the words value and object interchangeably. Note Actually, the 2 and the 3 that are part of the addition above are values(objects) as well. These objects are classified into different  classes , or  data types :  4  is an  integer , and  "Hello,   World!"  is a  string , so-called because it contains a string or sequence of letters. You (and the interpreter) can identify strings because they are enclosed in quotation marks. Một giá trị là một trong những thứ cơ bản - giống như một từ hoặc 1 số - mà một chương trình điều khiển. Những giá trị mà chúng ta có thể thấy trước là 5 (kết quả khi chúng ta cộng 2 + 3), và ...

1.14. Glossary

activecode A unique interpreter environment that allows Python to be executed from within a web browser. Mã kích hoạt Một môi trường thông dịch duy nhất cho phép Python có thể thực hiện từ trong một trình duyệt web. algorithm A general step by step process for solving a problem. Thuật toán: Một chương trình chung từng bước để giải quyết vấn đề bug An error in a program. Lỗi Một lỗi trong 1 chương trình byte code An intermediate language between source code and object code. Many modern languages first compile source code into byte code and then interpret the byte code with a program called a  virtual machine . Mã byte Một ngôn ngữ trung gian giữamã nguồn và mã đối tượng. Có rất nhiều loại hình ngôn ngữ đầu tiên biên soạn mã nguồn thành code byte và giải nghĩa mã byte với một chương trình gọi là một máy ảo. codelens An interactive environment that allows the user to control the step by step execution of a Python program Codelens Một môi trườ...

1.12. A Typical First Program

Traditionally, the first program written in a new language is called  Hello, World!  because all it does is display the words, Hello, World! In Python, the source code looks like this. Nhìn chung, chương trình đầu tiên được viết bởi một ngôn ngữ được gọi là "Hello, World!" bởi vì tất cả nó chỉ là hiển thị lên màn hình chữ "Hello, World!" trong Python, mã nguồn lập trình cũng như vậy. print ( "Hello, World!" ) This is an example of using the  print function , which doesn’t actually print anything on paper. It displays a value on the screen. In this case, the result is the phrase: Đây là 1 ví dụ của việc sử dụng chức năng in, đây không phải là in bất kỳ cái gì lên giấy. Nó chỉ hiển thị 1 giá trị trên màn hình. Trong trường hợp này, kết quả là 1 cụm từ: Hello, World! Here is the example in activecode. Give it a try! Save & Run Load History Show CodeLens 1 print ( "Hello, World!" ) ...