1.if-elif-else statement
format :
IF Expression 1:
(space) statement 1
elif expression 2:
(space) statement 2
elif Expression 3:
(space) statement 3
...
elif n-expression:
(space) statement n-
the else: # optional
(space) e statement
logic : when the program executes the if-elif-else statements, first calculated value "expression 1", if "expression 1" is true, is performed "statement 1", executing the "statement 1", then skip the entire if-elif-else statement; if "expression 1" is false, then the value "expression 2" is calculated, if "expression 2" If the value "expression 2" is false, then the calculation "expression 3"; is true, "statement 2", executing the "sentence 2", then skip the entire if-elif-else statement is executed . It goes really did not stop until the value of an expression. Without a true expression, and there is else statement, "statement e" is performed
each el denied it is above all an expression
** 2 ** infinite loop : expression is always true cycle
3.else statement
while expression:
(blank) sentence 1
the else:
(blank) sentence 2
** logic: ** conditional statement (expression) is False, executing the "statement 2" else in
4.for statement:
format :
for the variable name in the set of:
(space) statement
logic : for each element in order to take "set" is assigned to the "variable", executed again statements. So on ad infinitum, until the take complete "set" of elements cutoff
range ([start], end [ , step]) Function : list generator, start defaults to 0, the default is 0 STEP
functions: generating a list of
5.break statement
effect : out of for and while loops.
Note : You can only jump from its recent level of that cycle
Note: Loops can see the else statement, break the cycle leading to the cutoff, the following statement will not be executed else
6.continue statement
effect: skip the remaining statements in the current cycle, then proceed with the next cycle
Note: skip the nearest cycle