Understanding For Loops in
Python
A simple explanation
What is a For Loop?
• A for loop lets you repeat a task for every item
in a group.
• Example: Saying the name of every fruit in a
basket.
Example: Looping through Fruits
• fruits = ["apple", "banana", "cherry"]
• for fruit in fruits:
• print(fruit)
What This Does
• - Looks at each fruit in the list:
• - Prints 'apple'
• - Prints 'banana'
• - Prints 'cherry'
For Loop Structure
• for item in group:
• do something with item
• - 'item': temporary name for each element
• - 'group': the list or sequence
• - Indented code runs for each item
Visual: Looping Through a Basket of Fruits
apple banana cherry
print('apple') print('banana') print('cherry')