A: Sequence structure
Program order structure means that all the statements in the program are executed one by one in accordance with the written order, but the order of the structure of program function is limited.
2: Select structure
Selection structure also called a branched structure, for processing a case of performing two or more alternative paths appear in the program. Select the branch structure can be used to implement the statement.
2.1
The if statement
if expression 1:
Statement ...
elif expression 2:
Statement ...
else:
Statement ...
if nested
Statement format
if expression 1:
Statement ..
if Expression 2:
Statement ...
elif expression 3:
Statement ...
else:
Statement ...
elif expression 4:
Statement ...
else:
Statement ...
Three: loop control statements
3.1while statement
Statement format
while judgment conditions:
Statement ...
and while statements can be used in conjunction with else, showing a condition when the while statement is flase, the block of statements is executed else
Example:
a = 1
while a < 20:
print(a,"a<20")
a +=1
else:
print(a,"a>20")
3.2for statement
for conditional control statements are composed of two circular portions and
Statement format:
for <variable> in <sequence>:
Statement ...
else:
Statement ...
3.3continue statement
When you use continue statement, python will skip the remaining statements in the current loop statement, continue to the next cycle.
3.4pass statement
The pass statement is an empty statement, mainly in order to maintain the integrity of the program structure. Usually seen as a placeholder sentence.