白皮书下载
Variable / constant / data type
1、 Language type description
Variable:Is a value stored in memory. During initialization, the variable will open up a space in memory, in which the data value can be modified;
Constant:Yes, the value is assigned at the time of initialization, and the value cannot be changed;
Data type:When specifying different data types, the interpreter allocates the specified memory and determines what data can be stored in memory. Therefore, variables can specify different data types.
2、 Data type description
Number type:Used to store values. They are immutable data types, which means that changing the digital data type will assign a new object; Real rap supports four different data types: int (signed integer), long (long integer [can also represent octal and hexadecimal]), float (floating point) and complex (complex).
character string:A string or string is a string of characters consisting of numbers, letters, and underscores. It is the data type representing text in the programming language. There are two value sequences in the string list:
1. One is that the left to right index starts from 0 by default, and the maximum range is that the string length is less than 1;
2. The other is from right to left. The default index is - 1, and the maximum range is the beginning of the string; If you want to obtain a substring from a string, you can use [header subscript: tail subscript] to intercept the corresponding string, where the subscript starts from 0 and can be positive or negative, and the subscript can be empty to get the header or tail.
List:List list can complete the data structure implementation of most collection classes. It supports characters, numbers, strings, and even lists (that is, nesting). The list is identified by [] and is the most common composite data type. The variable [head subscript: tail subscript] can also be used to cut the value in the list. The corresponding list can be intercepted. The left to right index starts from 0 by default, and the right to left index starts from - 1 by default. The subscript can be empty, indicating that the head or tail is taken.
Tuple:Is another data type, similar to list. Tuples are identified by (). Internal elements are separated by commas. However, tuples cannot be assigned twice, which is equivalent to a read-only list.
Dictionaries:A dictionary is the most flexible type of data structure besides a list. A list is an ordered collection of objects, and a dictionary is an unordered collection of objects. The difference between the two is that the elements in the dictionary are accessed by keys, not by offsets. The dictionary is identified by '{}'. The dictionary consists of an index (key) and its corresponding value value.




