# 练习7.1 汽车租赁
prompt=input("Let me see if i can find you a Subaru\n")
print(prompt)
# 练习7.2 餐馆定位
print('please tell me how many people do you have')
number = int(input())
if number <= 8:
print("The reservation is successful")
else:
print("The reservation is not successful")
# 练习7.3 10的整数倍
number = int(input())
if number%10==0:
print("a multiple of ten")
else:
print("not a multiple of ten")
# 练习7.4 比萨配料
print("please input the toppings you want")
while True:
topping=input()
if topping!='quit':
print(f"add {topping}")
else:
break
# 练习7.5 电影票
print("pleasse tell me your age")
age=int(input())
if age<3:
print("free")
elif 3<=age<12:
print("10 dollars")
else:
print("15 dollars")
# 练习7.6 三种出路
print("please input the toppings you want")
active=True
while active:
topping=input()
if topping!='quit':
print(f"add {topping}")
else:
active=False
# 练习7.7
#ctrl+c 结束无限循环
# 使用while处理列表和字典
# 验证用户
unconfirmed_users=['aa','bb','cc']
confirmed_users=[]
while unconfirmed_users:
current_users=unconfirmed_users.pop()
print(f"veryfing user:{current_users}")
confirmed_users.append(current_users)
# 显示所有的已验证用户
print("\n the following users have been confirmed: ")
for user in confirmed_users:
print(user)
pets=['cat','dog','cat','duck','pig','cat']
while 'cat' in pets:
pets.remove('cat')
print(pets)
# 练习7.8 熟食店
sandwich_orders=['meat','egg','cheese','bacon']
finished_sandwich=[]
while sandwich_orders:
mid_sandwich=sandwich_orders.pop()
print(f"i made your {mid_sandwich} sandwich")
finished_sandwich.append(mid_sandwich)
print(finished_sandwich)
# 练习7.9 五香烟熏牛肉买完了
sandwich_orders=['meat','pastrami','egg','pastrami','cheese','pastrami','bacon']
print("the pastrami sandwich sell out")
while 'pastrami' in sandwich_orders:
sandwich_orders.remove('pastrami')
print(sandwich_orders)
# 练习 7.10 梦想中的度假胜地
print('if you could visit one place in the world,where would you go')
place=[]
active=True
while active:
placee=input()
if placee !='quit':
place.append(placee)
else:
active=False
print(place)