7-2 餐馆定位
7-9 五香烟熏牛肉
num=input("How many poeple will have dinner?\n")
num=int(num)
if num>8:
print("There is no empty.")
else:
print("There is a table.")
7-3 10的整数倍
num=input("Please input a number.\n")
num=int(num)
if num%10==0:
print("The number can be devided by 10.")
else:
print("The number can not be devided by 10.")
7-5 电影票
while True:
age=input("Please input your age('quit' for ending)\n")
if age=='quit':
break
age=int(age)
if age<3:
print("Your ticket is free.")
elif age<=12:
print("Your ticket costs 10 dollars.")
else:
print("Your ticket costs 15 dollars.")
7-8 熟食店
sandwich_orders=['tuna','pork','chicken','ham','vegetable','fruit']
finished_sandwiches=[]
while sandwich_orders:
sandwich=sandwich_orders.pop()
print("I made your "+sandwich+" sandwich. ")
finished_sandwiches.append(sandwich)
print(finished_sandwiches)
7-9 五香烟熏牛肉
sandwich_orders=['tuna','pastrami','pork','chicken','pastrami' ,'ham','vegetable','fruit','pastrami']
finished_sandwiches=[]
print("Pastrami sandwiches are sold out.")
while 'pastrami' in sandwich_orders:
sandwich_orders.remove('pastrami')
while sandwich_orders:
sandwich=sandwich_orders.pop()
print("I made your "+sandwich+" sandwich. ")
finished_sandwiches.append(sandwich)
print(finished_sandwiches)