# -*- coding: GBK -*-
number = list(range(1,6))
print(number)

输出为:

[1, 2, 3, 4, 5]

2、

# -*- coding: GBK -*-

even_numbers = list(range(2,11,2))
print(even_numbers)

输出为:

[2, 4, 6, 8, 10]

3、

# -*- coding: GBK -*-

squares = []
for value in range(1,11):
square = value**2
squares.append(square) print(squares)

输出为:

[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
05-21 22:04