高级编程技术作业第四周 第七章课后练习
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)
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)
相关文章推荐
- 高级编程技术作业第五周 第十章课后练习
- 高级编程技术作业第二周1 第三章课后练习
- 高级编程技术作业第三周 第五章,第六章课后练习
- 高级编程技术作业第二周2 第四章课后练习
- 第四周作业_Chapter 8课后练习
- 高级编程技术作业第一周2 第二章课后练习
- 第四周作业_Chapter 7课后练习
- 高级编程技术作业第五周 第九章课后练习
- 高级编程技术_课后作业(六)
- JavaScript第七章课后作业
- python从入门到实践第三章的课后练习作业
- python学习第七章用户输入和While循环部分课后练习自己尝试的代码
- 高编课后作业------第四周-2
- 第五周作业_Chapter 10课后练习
- 高级编程技术 第四周作业
- 第七章 数组 课后作业:
- C++ Primer Plus课后编程练习——第七章 函数-C++的编程模块(部分)
- 高级编程技术 课后作业五
- 高级编程技术 课后作业一
- 第一周作业_Chapter 2 课后练习