循环

if

if 条件:
#程序
elif 条件:
程序
else:
程序

for

for 变量 in 可迭代对象:
循环体代码

for..else(for 正常循环完后才会运行)

for 变量 in 可迭代对象:
循环体代码
else :
语句块

while

while 条件:
循环体代码

模式匹配(3.11 后)

match x:
case 0:
print("x is zero")
case 1 | 2:
print("x is one or two")
case _:
print("x is some other value")