【HW】 第七章作业 2018.3.26
2018-03-26 20:58
309 查看
Python代码:#Chapter 7 by szh 2018.3.26
print("\n7.1")
car = input("Enter the car you want: ")
print("Let me see if I can find you a " + car + '.')
print("\n7.2")
num = input("Enter the nnumber if people: ")
if int(num) > 8:
print("No empty table.")
else:
print("Have empty table.")
print("\n7.3")
num = input("Enter a number: ")
if int(num) % 10 == 0:
print("It's an integer multiple of 10")
else:
print("It isn't an integer multiple of 10")
print("\n7.4")
plzza_batching = []
while True:
string = input("Enter the batching: ")
if string.lower() == "quit":
break
plzza_batching.append(string)
print(plzza_batching)
print("\n7.8")
sandwich_orders = ['Bocadillo', 'Doner Kebab', 'Torta']
finished_sandwiches = []
for sandwich in sandwich_orders:
print(" I made your " + sandwich + " sandwich.")
finished_sandwiches.append(sandwich)
print(finished_sandwiches)
输出结果:
7.1
Enter the car you want: Subaru
Let me see if I can find you a Subaru.
7.2
Enter the nnumber if people: 9
No empty table.
7.3
Enter a number: 10
It's an integer multiple of 10
7.4
Enter the batching: pork
Enter the batching: tomato
Enter the batching: quit
['pork', 'tomato']
7.8
I made your Bocadillo sandwich.
I made your Doner Kebab sandwich.
I made your Torta sandwich.
['Bocadillo', 'Doner Kebab', 'Torta']
print("\n7.1")
car = input("Enter the car you want: ")
print("Let me see if I can find you a " + car + '.')
print("\n7.2")
num = input("Enter the nnumber if people: ")
if int(num) > 8:
print("No empty table.")
else:
print("Have empty table.")
print("\n7.3")
num = input("Enter a number: ")
if int(num) % 10 == 0:
print("It's an integer multiple of 10")
else:
print("It isn't an integer multiple of 10")
print("\n7.4")
plzza_batching = []
while True:
string = input("Enter the batching: ")
if string.lower() == "quit":
break
plzza_batching.append(string)
print(plzza_batching)
print("\n7.8")
sandwich_orders = ['Bocadillo', 'Doner Kebab', 'Torta']
finished_sandwiches = []
for sandwich in sandwich_orders:
print(" I made your " + sandwich + " sandwich.")
finished_sandwiches.append(sandwich)
print(finished_sandwiches)
输出结果:
7.1
Enter the car you want: Subaru
Let me see if I can find you a Subaru.
7.2
Enter the nnumber if people: 9
No empty table.
7.3
Enter a number: 10
It's an integer multiple of 10
7.4
Enter the batching: pork
Enter the batching: tomato
Enter the batching: quit
['pork', 'tomato']
7.8
I made your Bocadillo sandwich.
I made your Doner Kebab sandwich.
I made your Torta sandwich.
['Bocadillo', 'Doner Kebab', 'Torta']
相关文章推荐
- [置顶] CSAPP第七章家庭作业参考答案
- 第七章作业
- Python第七章课后作业
- 第四周作业——第七章动手试一试
- 第七章作业
- 第七章作业
- 【HW】第二章作业 2018.3.8
- 第七章 数组 课后作业:
- RFID第七章作业——物联网1122-08黄炜彬
- 算法作业HW25:LeetCode 26. Remove Duplicates from Sorted Array
- 第四周作业——第七章
- 【HW】 第八章作业 2018.3.29
- 第五次作业(第七章)
- 《Java数据结构和算法》第二版 Robert lafore 编程作业 第七章
- 【RFID第四次作业】第七章课后习题
- 【高编作业】第七章课后题
- 第七章 Linux文件和目录相关的知识 作业题
- 【HW】第五章作业 2018.3.19
- 【HW】第四章作业 2018.3.14
- 第七章 Linux文件和目录相关的知识 作业题