0
Does range function always takes one parameter?
3 Réponses
+ 1
With two params, the output would look like the below.
x = list(range(5, 10))
print(x)
# [5,6,7,8,9]
With three params, the output would look like the below--where the third param is the gap between each input.
x = list(range(5, 10, 2))
print(x)
# [5,7,9]
Note: alphabet letters don't work with range.
0
no
0
# Just kidding :)
step = input("Enter a number: ")
x = range(0, 1000, step)
print x