Range in python is a in-build function which return the collection of sequential numbers started from the 0 by default up to specified range. It uses in python programming where we want to generate some sequential numbers.
Example -
range(4) will give 0,1,2,3
range(1,5) will give 1,2,3,4
range(5,1) will give nothing
Program -
t=range(4)
print(list(t))
t=range(1,5)
print(list(t))
t=range(5,1)
print(list(t))
t=range(4,4)
print(list(t))
for i in range(2):
print("Text")
[0, 1, 2, 3]
[1, 2, 3, 4]
[]
[]
Text
Text