A loop statement:
1.1 for X in Rang (n): #rang (n) generates a sequence of left closed right open intervals
1.2 While x condition N:
Two conditional statements:
An IF condition expression:
Elif expression:
Elif expression:
...
Else
Three Break Continu
Four: function:
4.1 Definition: def func (parameter list):
if not isinstance(x, (int, float)):#参数检查相当于断言
raise TypeError(‘bad operand type‘)
Return argument list # "when more than one return is actually returned a tuple (with the remaining parentheses), does not show return actually went back to none"
4.2 References: from filename.py import func_name
4.3 null function: Def NOP ():
Pass #占位语句, error-proof also for later expansion convenience.
4.4 Parameters of the function: Default parameter (x,y=2), variable parameter (equivalent to tuple, * tuple or list), keyword argument (dict class * *). The name keyword argument (*,x,y):* followed by the keyword argument.
4.5 Recursive function: Clear structure (recursive can be written as a looping structure), but to prevent stack overflow (to be optimized with tail recursion)
The structure statement of Python learning