您的位置:首页 > 其它

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:]))
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  homework