1. Variables
The concept of variables: variables are meant to store some intermediate results in the process of program operation, in order to facilitate later invocation
Naming rules for variables:
1. To have descriptive
2. Variable name can only _, number, letter composition, can not be a space or special characters (#?<.,¥$*!~)
3. Cannot use Chinese as variable name
4. Cannot start with a number
5. Reserved characters cannot be used
X=1y=2z=x*yprint("x multiplied by y equals:", Z)
Output Result:
x multiplied by y equals: 2
2. Constants
The concept of constants: The unchanging amount of pie = 3.141592653 ....
All variables in Python are mutable, so the variable names are all capitalized to represent the secondary variables as constants.
3. Comments
Single-line comment with #
Multiline comment with three single quotes or three double quotation marks ' ' annotated content '
# Use the # single-line comment, Python single-line comment " " Single quote multi-line comment, Python multiline comment single quote multiline comment, Python multiline comment single quote multiline comment, Python multiline comment " " """ double quotes multi-line comment, Python multiline comment Double quote multiline comment, Python multiline comment Double quote multiline comment, Python multiline comment """
Python Learning (2) variables, constants, annotations