您的位置:首页 > 编程语言

高级编程技术作业第四周 第七章课后练习

2018-03-28 20:06 351 查看
7-1  汽车租赁car = input("What kind of car do you would like to rent?\n")
print("Let me see if I can find you a "+car)7-2 people = input("Please tell me how many people would come to have a dinner?\n")
people = int(people)
if people > 8:
print("No available table")
else:
print("OK")
7-4while 1:
pizza = input("Pizza ingredients:\n")
if pizza == "quit":
break
else:
print("We will add " + pizza + " to the pizza.") 7-5while 1:
age = input("Your age?\n")
if age == "quit":
break
age = int(age)
if age < 3:
print("free")
elif age < 12:
print("10 dollars")
else:
print("15 dollars")7-8sandwich_orders = ['Bacon Sandwich','Egg Sandwich','Cream Sandwich']
finished_sandwiches = []
while sandwich_orders:
sandwich = sandwich_orders.pop()
print("I made your " + sandwich + " sandwich.")
finished_sandwiches.append(sandwich)
for sandwich in finished_sandwiches:
print(sandwich)7-10vacation_places={}
client = True
while client:
name = input("What's your name?\n")
print("Hello, " + name)
place = input("Where do you want to visit on your vacation?\n")
another = input("Would you like to let another person respond?(yes/no)\n")
vacation_places[name]=place
if another == 'no':
client = False
for name,place in vacation_places.items():
print(name + " would like to visit " + place)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: