For Loop
used to iterate over sequences such as lists, tuples, strings and ranges
s = "Geeks"
for i in s:
print(i)
Output:
G
e
e
k
s
for i in range(0, 10, 2):
print(i)
Output:
0
2
4
6
8
for i in range(1, 4):
print(i)
else:
print("No Break\n")
Output:
1
2
3
No Break

Top comments (0)