loop in string in python code example
Example 1: how to loop through string in python
for i in "Hello":
print(i)
Example 2: python iterate over string
word = "test"
for letter in word:
print(letter)
Example 3: 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