Variables and Constants

Variable Definition Specification
1. The variable name can only be any combination of letters, numbers or underscores
2. The first character of the variable name cannot be a number
3、以下关键字不能声明变量名 ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']

How variables are defined
hump
AgeOfOldboy=56
NuberOfStudents=80
 
 
x
 
 
 
1
AgeOfOldboy=56
 
 
2
NuberOfStudents=80
 
 
underscore
age_of_oldboy=56
nuber_of_students=80
 
 
 
1
 
 
1
age_of_oldboy=56
 
 
2
nuber_of_students=80
 
 
The way the variable defines LOW
1. The variable name is Chinese, Pinyin
2. The variable name is too long
3. Variable nouns do not convey their meaning
 
constant
Constants refer to invariable quantities, such as pai 3.141592653.., or quantities that will not change during program execution
There is no special syntax to represent constants in Python, programmers have a convention to use all uppercase variable names to represent constants
AGE_OF_OLDBOY=56
 
 
1
 
 
 
 
 
1
AGE_OF_OLDBOY=56
 
 
There is a special constant definition syntax in the c language, const int conut =60; if a quantity is defined as a constant, an error will be reported if the change is made
 

<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324984157&siteId=291194637