hoemwork4
2018-03-14 21:40
211 查看
4-2
a
animals = ['tiger', 'lion', 'wolf'] for animal in animals: print(animal)
b
animals = ['tiger', 'lion', 'wolf'] for animal in animals: print('The ' + animal +' is terror!')
c
animals = ['tiger', 'lion', 'wolf'] for animal in animals: print('The ' + animal +' is terror!')
print("Any of these animals eat meat!")
4-3
for num in list(range(1,21)): print(num)
4-9
cube = [value ** 3 for value in range(1,11)] print(cube)
4-10
a
cube = [value ** 3 for value in range(1,11)] print("The first three items in the list are:" + str(cube[0:3]))
b
cube = [value ** 3 for value in range(1,11)] print("Three items from the middle of the list are:" + str(cube[3:6]))
c
cube = [value ** 3 for value in range(1,11)] print("The last three items in the list are:" + str(cube[-3:]))
相关文章推荐
- Java_洪泽海_1029_homework
- Java_洪泽海_1105_homework
- 假如我我是个python程序高手,我打算实现的程序及目标
- 第一周作业
- hdu1074 Doing Homework(状态压缩dp)
- Still in 烦躁 feeling
- [Course] Advanced Computer Programming, Homework, week 1
- 课程:高级编程技术 作业(1)
- 高级编程技术作业 (二)
- 高级编程技术作业 (三)
- oracle9i sql与pl/sql的习题结果
- unity3d运行在android平台的一个demo
- Advice for Computer Science College Students
- 开学第一课,初识python
- How to Improve Your Public Speaking: 27 Tips, Tricks, and Tutorials
- 20060802
- Effective preparation
- Happy exam
- My mother is strict with me
- homework2