3. 分支与循环
3.1 分支结构
if
语句的五种语法
# 1
if condition:
statement(s)
# 2
if condition:
statement(s)
else:
statement(s)
# 3
if condition1:
statement(s)
elif conditions2:
statement(s)
elif condition3:
statement(s)
# 4
if condition1:
statement(s)
elif conditions2:
statement(s)
elif condition3:
statement(s)
else:
statement(s)
# 5
statement(s) if condition else statement(s)
a = 3
b = 5