创建数值列表
2018-10-26 本文已影响7人
庵下桃花仙
for number in range(1, 21):
print(number)
values = list(range(1, 1000001))
print(min(values))
print(max(values))
print(sum(values))
odd_values = list(range(1, 20, 2))
for odd_value in odd_values:
print(odd_value)
cubes = [value**3 for value in range(1, 11)]
print(cubes)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
1
1000000
500000500000
1
3
5
7
9
11
13
15
17
19
[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]