# Display Value from 1 TO 3
for i in range(1,4):
print "",i,"value of loop"
# Loop for dictionary data type
mydata = {"Fahim":"Pakistan", "Vedon":"China", "Bill":"USA" }
for user, country in mydata.iteritems():
print user, "belongs to " ,country
#(initial,final but not included,gap)
for i in range(1,10,2):
print(i);
1,3,5,7,9
# (initial, final but not included)
# note: 4 not included
for i in range (1,4):
print(i);
1,2,3
#note: 5 not included
for i in range (5):
print (i);
0,1,2,3,4
# you can also iterate over strings
myList = ["ml","ai","dl"];
for i in myList:
print(i);
output: ml,ai,dl