Range Function In Python

 Range Function.

The value we put in range Function determines how many times we will Loop. The  range Function is used with the Loops statements.
Some range function statements and their value are ::

Statements:                      Values generate:
range(10)                          0,1,2,......,8,9
range(1,10)                       1,2,.....,7,8,9
range(3,7)                         3,4,5,6
range(2,15,3)                    2,5,8,11,14
range(9,2,-1)                     9,8,7,6,5,4,3


Program of range function :
   for i in range(5,0,-1):
          print(i, End=" ")
   print("Range function")

>> Output >> 5,4,3,2,1 Range Function >>

Comments

Popular posts from this blog

C Program to Sort Id, Name, Address of Student using structure.

Star Topology

Strings in Python