007 Constant

table of Contents

First, the constant

Variable is the amount of change, constants are the same amount. python syntax is not used arbitrarily defined constants, that is to say, python variable is defined in the constant nature. If you have to define constants, variable names must be all uppercase.

AGE_OF_XUCHENG = 19
print(AGE_OF_XUCHENG)   # 19
                
AGE_OF_XUCHENG = AGE_OF_XUCHENG + 1
print(AGE_OF_XUCHENG)   # 20

If it is constant, then we need to change, so it is only python developed a specification, but did not specify the syntax constants, and therefore also the constant can be modified, but not recommended.

There are special constants defined in the c language grammar, const int age = 19;once defined ageas the constant change agethat is being given.

Guess you like

Origin www.cnblogs.com/XuChengNotes/p/11264999.html