1、选择语句(if)
###e.g.1
if xx :
statement1
else :
statement2
###e.g.2
if xx :
statement1
elif yy:
statement2
......
else :
statement3
###e.g.3
if xx :
statement1
if yy :
statement2
if zz :
statement3
2、循环(while)
##e.g.1
while xx: statement
##e.g.2
while xx:
statement
if yy:
continue(或者break)
##e.g.3
while xx:
statement1
else:
statement2
3、循环(for)
#e.g.1
for xx in list/string/tuple...
statement1
#e.g.2
for index in list/string/tuple...length:
list/string/tuple[index]
4、空语句 pass
#e.g.2
for xx in yy:
statement1
else:
statement2
时间: 2024-10-17 14:59:25