for Loops and range()
Iterate over sequences and ranges with for loops.
Introduction
The for loop iterates over any iterable. range() generates integer sequences on demand.
Basic for Loop
for item in iterable: runs the block once per item. Works with lists, strings, dicts, sets, files — anything iterable.
for fruit in ['apple', 'banana', 'cherry']:
print(fruit)