逻辑运算
==(相等) !=(不等) and(与) or(或) not(非)
短路求值
if语句
#example1.py
if age <= 2 :
print('free")
elif 2<age<13 :
print("child fare")
else:
print('adult fare')
#example2.py
reply = 'yuck' if food == 'lamb' else 'yum'
for循环
for i in range(10)
print(i) #打印从0到9
for i in range(5,10)
print(i) #打印从,5到9
for i in range(10,0,-1)
print(i) #打印从10到1
while循环
while condition:
statements
break和continue
break跳出当前循环
continue跳过当前迭代,直接进入下一次迭代