【python】第四次课作业
2018-03-14 23:12
666 查看
4-1pizzas = ['dasd', 'gthy', 'hyt', 'oiuy']
for pizza in pizzas:
print(pizza)
for pizza in pizzas:
print("I like "+pizza+"pizza.")
print("I really love pizza!")
4-3~4-9for i in range(1, 4):
print(i)
three = [value**3 for value in range(1,5)]
print(three)
4-10names = ['Karry', 'Roy', 'Jackson', 'Leo', 'Nemo', 'Lucky']
print("Total list is:")
print(names)
print("The first three items in the list are:")
print(names[:3])
print("The last three items in the list are:")
print(names[-3:])
print("Three items from the middle of the list are:")
print(names[2:5])
4-11pizzas = ['dasd', 'gthy', 'hyt', 'oiuy']
friend_pizzas = pizzas[:]
pizzas.append('bcshj')
friend_pizzas.append('ql')
print("My favorite pizzas are:")
for pizza in pizzas:
print(pizza)
print("My frined's favorite pizzas are:")
for pizza in friend_pizzas:
print(pizza)
4-13foods = ('dsdf', 'rew', 'eret', 'oiu', 'cvx')
for food in foods:
print(food)
print("After some change:")
foods = ('akj', 'rew', 'eret', 'pijdhf', 'cvx')
for food in foods:
print(food)
for pizza in pizzas:
print(pizza)
for pizza in pizzas:
print("I like "+pizza+"pizza.")
print("I really love pizza!")
4-3~4-9for i in range(1, 4):
print(i)
three = [value**3 for value in range(1,5)]
print(three)
4-10names = ['Karry', 'Roy', 'Jackson', 'Leo', 'Nemo', 'Lucky']
print("Total list is:")
print(names)
print("The first three items in the list are:")
print(names[:3])
print("The last three items in the list are:")
print(names[-3:])
print("Three items from the middle of the list are:")
print(names[2:5])
4-11pizzas = ['dasd', 'gthy', 'hyt', 'oiuy']
friend_pizzas = pizzas[:]
pizzas.append('bcshj')
friend_pizzas.append('ql')
print("My favorite pizzas are:")
for pizza in pizzas:
print(pizza)
print("My frined's favorite pizzas are:")
for pizza in friend_pizzas:
print(pizza)
4-13foods = ('dsdf', 'rew', 'eret', 'oiu', 'cvx')
for food in foods:
print(food)
print("After some change:")
foods = ('akj', 'rew', 'eret', 'pijdhf', 'cvx')
for food in foods:
print(food)
相关文章推荐
- 马哥2016全新Linux+Python高端运维班第四期-第四次作业
- Linux+Python高端运维班第四次作业
- Python第四次作业
- 【python】第四次课作业
- 马哥2016全新Linux+Python高端运维班第四期-第四次作业
- python作业3
- 第四次作业
- Deeplearning-吴恩达-卷积神经网络-第一周作业01-Convolution Networks(python)
- SDUST 第四次作业
- SDN第四次上机作业
- 第四次寒假作业
- 第四次作业
- 软件工程第四次作业
- Python第四天课后作业
- python作业2
- python课程学习-模块1-作业-02三级菜单
- Python自然语言分析(第四期):第1课书面作业
- 第四次作业
- Python实战计划学习作业1-1
- 第四次寒假作业