home ~ projects ~ socials

Make A Set In Python

Make sets with {} or set()

items = { "alfa", "bravo", "alfa", "charlie" }
items.add("delta")
items.add("alfa")

print(items)
Output:
{'alfa', 'charlie', 'bravo', 'delta'}

Note that alfa only shows up once in the output

-- end of line --

References