Pythonトレーニング


4.2-2 range関数

rangeの構文 range(stop) range(start, stop, [step])

print(list(range(10)))
->[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

print(list(range(2, 10)))
->[2, 3, 4, 5, 6, 7, 8, 9]

print(list(range(2, 10, 2)))
->[2, 4, 6, 8]