for loop operators python code example
Example 1: how to do a for loop python
print(range(4))
>>> [0,1,2,3]
print(range(1,4))
>>> [1,2,3]
print(range(2,10,2))
>>> [2,4,6,8]
Example 2: python for loop
my_list = ["milk", "coffee", "bread"]
# i stands for iterator
for i in my_list:
print(i) # prints every element of my_list