Range() in Python by R4R Team

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")


output -

[0, 1, 2, 3]
[1, 2, 3, 4]
[]
[]
Text
Text

Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!