# 条件语句中,缩进决定从属关系
if condition:
statement(s)
else:
other statement(s)
# 条件表达式
statement(s) if condition else other statement(s)
if condition1:
statement(s)1
elif condition2:
statement(s)2
elif condition3:
statement(s)3
else:
other statement(s)
# 循环
while condition:
statement(s)
# 当while的条件不再为真时,执行else语句
# 如果直接用break跳出循环,此时while的条件可能仍然为真,则不执行else语句
else:
statement(s)
# for循环
for 变量 in 可迭代对象:
statement(s)
for each in 'Test':
print(each)
range(stop) #生成0到stop-1的整数
range(a,b) #生成从a到b-1的整数。
range(a,b,c) #步长为c