1、if判断语句
cars=['audi','bmw','subaru','toyota']
for car in cars:
if car=='bmw': #判断还是要考虑大小写的,也是需要用==小心
print(car.upper())
else:
print(car.title())

所有的if-else条件都是要加: 的,别忘加
age=21
if age<4:
price=0
elif age<18:
price=5
elif age<65:
price=10
else:
price=5
print("Your adiminssion cost is $"+str(price)+".")
![]()
requested_toppings=[]
if requested_toppings:
print("OK!")
else: print("NO!")
![]()

最低0.47元/天 解锁文章
1317

被折叠的 条评论
为什么被折叠?



