Skip to main content

Loop Items

A for loop visits each item of a set in turn:

Example

Print each value as the loop reaches it:

Prompt
Create a set with "apple", "banana", and "cherry". Loop through the set using a for loop and print each value.
Output: complete Python program