python basis - variable

python basis - variable

variable:

1, a variable is a letter or symbol, the value of the generated program is running record, the latter supplying the program to use.
2, variable: the result of the operation of
3, variable, depending on the amount of meaning too can be changed, can also be considered to be our mathematics was unknown x.
For example: a = 3 * 6 left // Note the equal sign in mathematics is not the equal right of meaning, the meaning of the equal sign is the assignment of meaning. The value assigned to the variable right-hand side of the equal sign on the left.
4. "#" comment, followed by the pound sign is a comment, the posters are not for the machine to read. This is called single-line comments.
Multi-line comments: '' '

Exercise:

Here Insert Picture Description
Note:
A = 18 is
Print ( "A") // output here is a, because it is a string, the string variable does not matter. Another point, there must be a variable to use.
Here Insert Picture Description

Variable naming conventions:

1, must be a number, letter, underscore combination.
Such as: = "Alex" // _ here is variable
Print (
) prints out variables //
2, is not purely digital not begin with a digit.
3, remember! Remember! Remember! Variables which must not have Chinese.
4, can not use keywords, which is already occupied by a python stuff.
5, should not be too long.
6, to be meaningful.
7, case-sensitive, and Chinese characters.
8, recommended hump, for example: JingYi. Recommended underline clearly distinguish between each word, such as: jing_yi

constant:

1, there is no absolute constants in python agreement aging, all capital letters is a constant
example: PI = 3.1415926
2, is in fact a constant variable, but usually Xia Buqu change.

Note: This is the beep beep Mile Mile watch video python old boy training institutions to do the above notes, talking about very basic, easy to understand. I am grateful old boy institutions.

Released seven original articles · won praise 3 · Views 235

Guess you like

Origin blog.csdn.net/qq_41397071/article/details/104032989