Google News
logo
Python Program to Loop through a set
In the following example of Python program that loops through a set and prints each item :
Program :
# Create a set
my_set = {"apple", "banana", "cherry"}

# Loop through the set and print each item
for item in my_set:
    print(item)
Output :
banana
apple
cherry