Conditional statement
If judgment condition:
Execute statement ...
ELSE:
EXECUTE statement ...
If Judge condition 1:
EXECUTE statement 1
... Elif Judgment Condition 2:
EXECUTE statement 2
... Elif judgment Condition 3:
EXECUTE statement 3
... ELSE:
EXECUTE statement 4 ...
Loop statement
While judgment condition:
EXECUTE statement ...
Two important commands: The Continue is used to skip the cycle, and the break is used to exit the loop. In nested loops, the break exits the deepest loop statement. Pass is an empty statement, used to occupy bits.
For Iterating_var in sequence:
statements (s)
For letters in ' Python ': # First Instance
print ' Current letter: ',
fruits = [' banana ', ' apple ', ' Mango ']
For fruit in fruits: # Second Instance
print ' Current fruit: ', fruit
print ' good bye! '
Fruits = [' banana ', ' apple ', ' Mango '] for
index in range (len (fruits)):
print ' current fruit: ', fruits[index]