Python development [2] basics and python Development
Initial recognition of Variables
Variable is a new knowledge point and a concept that needs to be well known when learning Python. Python is a dynamic type language. It can be bound to a value of different types during the assignment execution. This process is called the variable assignment operation. The assignment also determines the type of the variable.
Variable naming rules
- A variable consists of letters, numbers, and underscores.
- A variable cannot start with a number. For example, 2abc is an incorrect variable name.
- Variables are case sensitive, such as name! = Name
- Variables must be named by meaningful characters.
- Variables cannot be named using keywords defined in Python.
Variable assignment
>>> X = 5 this operation is to assign a value, which means to assign the integer number 5 to the variable x and connect the variable name and value with an equal sign. Then you can use the new variable in the expression. >>> X * 315 Note: When a value is assigned, the Data Type of the value determines the type of the variable. The variable name references the value and its type.
Note
Single line comment #
Comment ''' or "" on multiple lines """
Note: ''' or "can be used not only for commenting, but also for assigning values to variables. For example:
Msg = "----------- info of liqiang ------------- Name: liqiang Age: 29 Job: IT Salary: 3000 ---------------- end ------------------" print (msg) the output result is as follows: ----------- info of liqiang ------------- Name: liqiang Age: 29 Job: IT Salary: 3000 ---------------- end --------------------