#!/user/bin/env python
cars = ['audi','bmw','subaru','toyota']
for car in cars:
if car == 'bmw':
print(car.upper())
else:
print(car.title())
# == !=
# <= >=
# and or
# in not in
# True False
# if-else
# if-elif-elif-else # 选择一个执行
requesed_toppings = ['mushrooms','green peppers','extra cheese']
for requesed_topping in requesed_toppings:
if requesed_topping == 'green peppers':
print("Sorry,we are out of green peppers now.")
else:
print("Addin" + requesed_topping + ".")
print('\nFinished making your pizza!')
# 确定列表不是空
requesed_toppings = []
if requesed_toppings:
for requesed_topping in requesed_toppings:
print("Adding" + requesed_topping + ".")
print("\nFinished making your pizza!")
else:
print("Are you sure you want a plain pizza?")