num = input("The number of people who will eat here is:")
num = int(num)
if num >= 8:
print("Do not have enough tables!")
else:
print("Have enough tables!")
while(1):
age = input("What's your age? ")
age = int(age)
if age<3:
print("The ticket is free.")
elif age>12:
print("The price is $15")
else:
print("The price is $10")
7-8 熟食店 :创建一个名为sandwich_orders 的列表,在其中包含各种三明治的名字;再创建一个名为finished_sandwiches 的空列表。遍历列表sandwich_orders ,对于其中的每种三明治,都打印一条消息,如I made your tuna sandwich ,并将其移到列表finished_sandwiches 。所有三明治都制作好后,打印一条消息,将这些三明治列出来。
代码如下:
sandwich_orders = ["tomato_sandwich","beef_sandwich","potato_sandwich","tuna_sandwich"]
finished_sandwiches = []
for sandwich in sandwich_orders:
print("I made tour "+ sandwich)
finished_sandwiches.append(sandwich)
print(finished_sandwiches)