for loop in Paython


Prev Tutorial Next Tutorial

for loop in Python

Loops are used in programming to repeat a specific block of code on the basis of certain condition. In python for loop is used for run same sequence number of times.

For Loop Syntax Python

for <variable> in <sequence>:  
for <variable> in <sequence>:  

Python for loop example

num=2  
for i in range (1,6):  
print i

Output

	


Prev Tutorial Next Tutorial

Advertisements
Download Projects