for Loop
noun
say it: “FOR loop” /ˈfɔr lup/
A Python loop that repeats a block of code once for each item in a collection, such as each guest in a list.
What is a for loop in Python?
A for loop repeats a block of code once for each item in a collection.
for guest in ["Ana", "Ben", "Cai"]:
print(f"Welcome, {guest}!")
In a sentence
- “A for loop over range(1, 11) prints the numbers 1 to 10.”
- “The for loop welcomed each guest by name.”
Level: Apprentice · More Python terms at this level
Updated