1for i in range(1,10,2): #(initial,final but not included,gap)
2 print(i);
3 #output: 1,3,5,7,9
4
5for i in range (1,4): # (initial, final but not included)
6 print(i);
7 #output: 1,2,3 note: 4 not included
8
9for i in range (5):
10 print (i);
11 #output: 0,1,2,3,4 note: 5 not included
12
13python = ["ml","ai","dl"];
14for i in python:
15 print(i);
16 #output: ml,ai,dl
17
18for i in range(1,5): #empty loop...if pass not used then it will return error
19 pass;
20
1adj = ["red", "big"]
2fruits = ["apple", "banana"]
3
4for x in adj:
5 for y in fruits:
6 print(x, y)
7 #output: red apple, red banana, big apple, big banana
1# how to use for in python for (range, lists)
2fruits = ["pineapple","apple", "banana", "cherry"]
3for x in fruits:
4 if x == "apple":
5 continue
6 if x == "banana":
7 break
8 print(x)
9# fron 2 to 30 by 3 step
10for x in range(2, 30, 3):
11 print(x)