python for loop in code example
Example 1: for in python
for i in range(1,10,2):
print(i);
for i in range (1,4):
print(i);
for i in range (5):
print (i);
python = ["ml","ai","dl"];
for i in python:
print(i);
for i in range(1,5):
pass;
Example 2: python for in for in
adj = ["red", "big"]
fruits = ["apple", "banana"]
for x in adj:
for y in fruits:
print(x, y)
Example 3: python for loop
words=['zero','one','two']
for operator, word in enumerate(words):
print(word, operator)
Example 4: python for loop
for item in ['mosh','john','sarah']:
print(item)