today look at the variables and constants of Python:
first, let's talk. The interpreter executes the Python process: Python3 C:\test.py
1. Start the Python interpreter (in memory)
2. Read the C:\test.py content from the hard disk into memory (this step is the same as the text editor)
3. Execute code that reads into memory
If you want to permanently save your code, you need to use the file
If you want to debug your code, you need to use an interactive approach
What is a variable?
Change , core in and change Quantity: Measurement, measurement, expression is a state
Definition of a variable
Ps:
Level = 1
Level: Variable name =: assignment operator 1: value
To define a rule:
Variable names can only be any combination of letters, numbers, or underscores
The first character of a variable name cannot be a number
The following keywords cannot be declared as variable names
[' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' Def ', ' del ', ' elif ', ' Else ', ' except ', ' exec ', ' finally ', ' for ', ' F ' Rom ', ' Global ', ' if ', ' import ', ' in ', ' was ', ' lambda ', ' not ', ' or ', ' pass ', ' print ', ' raise ', ' return ', ' try ', ' while ', ' WI Th ', ' yield ']
Python has a resource recovery mechanism
Ps:
Name= ' Lln ' # ' Lln ' reference count of this value +1
Name= ' Llh ' # ' LLH ' reference count of this value +1, ' Lln ' reference count of this value-1
The value of the reference count or the value of the body is bound to a variable named 0, the Python interpreter will periodically reclaim their free space.
is the comparison id = = is the comparison value
three important components of a variable definition:
ID Address
Type types
Value values
Ps:
Constant
Constant amount of
There is no specific way to define constants in Python, usually with uppercase variable names representing constants
Just a hint of the effect
Ps:
LLN_BODY=50 (Nature or variable can be changed value)
Small knowledge points: the way you define them is usually a camel's body and underline.
Ps:
LlnOldboy = 50
lln_oldboy = 50
Annotation rules:
1 #单行注释 2 #注释可以是英文和中文不能使用拼音 3 4 "" "5 multiline Comment 6 first way 7" "" 8 9 "' 10 multiline Comment 11 second way 12" '