Python For Loops
01
The for Loop
A for loop is used for iterating over a sequence (that is either a list, tuple, dictionary, set, or string).
Example
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)Output
apple banana cherry
A for loop is used for iterating over a sequence (that is either a list, tuple, dictionary, set, or string).
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)Output
apple banana cherry