range
range(start, stop[, step])
- start: Counting starts from start. The default is to start from 0. For example, range(5) is equivalent to range(0, 5)
- stop: Count to the end of stop, but stop is not included. For example: range(0, 5) is [0, 1, 2, 3, 4] without 5
- step: step length, the default is 1. For example: range(0, 5) is equivalent to range(0, 5, 1)
for i in range(10):
print(i,end=" ")
for i in range(0,10):
print(i,end=" ")
for i in range(5,10):
print(i,end=" ")
for i in range(10,-1,-1):
print(i,end=" ")