1. What is a variable
Variable as the name implies the amount of change, the amount is a way of representing a state, and can be changed
2, why to use the variable
The execution of a program is always in a state of flux, and we can use a variable to represent the state of the program in progress and record it.
3. How to use variables
Key=value
Example
A=123
Three elements of a variable:
Key ———— "a"
= ————— "Assigned value
123 ———— "Specific status (content)
A variable is defined in a way that has its fixed name:
Variable names can only be any combination of letters, numbers, or underscores
The first character of a variable name cannot be a number
Cannot conflict with Python keyword (avoid invoking problems in use)
[' 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 ', ' when ', ' with ', ' yield ']
The significance of defining variables is that we call this variable later, so it is best to set the variable name with its special meaning, example:
Name= ' Wyf '
Age=26
salary=1000000 # #意淫的
Underline is also good, can be relatively clear expression of a relatively long variable:
student_of_middle=300 #中学生300人
1. Python Variable settings