1. Comments
Start with #
2. String
The data type is str type;
Enclosed in double quotation marks "" or single quotation marks, if the string contains characters, the ' This is a ' string ' format
3. Number
There are only two types of int and float type.
The accuracy of the flaoat type is approximately 15 bits after the small tree point.
4. Operators
5 Basic operators: + 、-、 *,/,**
Modulo operation:%
The divisible operator://returns the truncated integer.
5. Method (function)
(1) The format is as follows
def method name ([parameter 1],[parameter 2] ...):
Method body
Return
(2) Description:
A. Method names are named in the same variable name format, parameters can be either not, or by multiple
B. Method name followed by ":"
C. A method body is represented by a character indent.
D. Each method has a return value, and if no return is written in the method, the default return is None (return none)
6. Import keyword
Introducing Libraries
7. Boolean type (bool) and logical operator
BOOL Type: TRUE, False
Logical operators: And,or,not
8. Relational operators
==,!=,>=,<=,>,<
9. Conditional statements
if (bool value):
Program block
Elif (bool value):
Program block
Elif.
Else
Program block
Tips
1, the '//' operator is not rounded, to be rounded, use the round () function.
2, the use of modulo operation: can deal with circulation problems, such as snake game (snake into the right edge from the left side of the border out), circular clock problems (from the current point of time, the time of the hours after the request)
3. The blocks in Python are identified by character indentation.
(i) Basic Python syntax