#coding:gbk#7-8熟食店
sandwich_orders =['a','b','c','d']
finished_sanwiches =[]for sandwich_order in sandwich_orders:print("I made your "+ sandwich_order.title()+"sandwich.")while sandwich_orders:
x = sandwich_orders.pop()
finished_sanwiches.append(x)print("\nThe following sandwiches have been finished: ")for sandwich in finished_sanwiches:print(sandwich)print(finished_sanwiches)#验证新列表的成功导入#7-9五香烟熏牛肉卖完了
sandwich_orders =['a','pastrami','b','pastrami','c','pastrami','d']print("熟食店的五香烟熏牛肉卖完了:")#print(sandwich_orders)while'pastrami'in sandwich_orders:
sandwich_orders.remove('pastrami')print(sandwich_orders)#7-10梦想的度假胜地
dream_places ={}
active =Truewhile active:
name =input("您的名字:")
response =input("您梦想的度假胜地是哪里呢?")
dream_places[name]= response #运用一次键-值对地赋值即可,不用分别对键和值进行赋值
repeat =input("您是否希望另一个人接受调查呢?(是/否)")if repeat =="否":
active =Falseprint("\n--- 结果 ---")for name,response in dream_places.items():print(name +"希望去"+ response)