Python_01f
Python_01f
# Sets are used to store multiple items in a single
# variable.
# A set is a collection which is unordered,
# unchangeable, and unindexed.
# Note: Set items are unchangeable,
# but you can remove items and add new items.
thisset = {"apple", "banana", "cherry", "apple"}
# NB Duplicate item is just ignored
print(thisset)
# New items added
thisset.add("orange")
# or one-by-one with no guaranteed order
for x in thisset:
print(x)