For loop in Python

In python, the for loop can be used only on array variables. It is used to iterate over a group of data.

Syntax : 

for variable in arrayname :
    print(variable)

Example :

clothes = ['shirt','pant','tshirt']

for var in clothes :
    print(var)

Output for the above code will be :

shirt
pant  
tshirt

© Copyright - 2018 - 2021 | All rights reserved at Funda of Web IT