S = {10, 3, 7, 2, 11}
S
T = {5, 4, 5, 2, 4, 9}
T
L = [10, 13, 10, 5, 6, 13, 2, 10, 5]
S2 = set(L)
S2
# Union (Elements in S or T or both)
S | T
# Intersection (Elements common to both S and T)
S & T
# Set Difference (Elements in S but not in T)
S - T
# Symmetric Difference (Elements in S or T, but not both)
S ^ T
# Set Membership
3 in S
# Set Membership
3 not in S
# Set Equality (Sets S and T contain exactly the same elements)
S == T
# Subset (Every element in set T also is a member of set S)
T <= S
# Proper subset (A is a subset B, but B contains at least one element not in A)
T < S
# add() for enkelt-elementer
# update() for lister av nye elementer
fruitset = {"apple", "banana", "cherry", "durian", "mango"}
print(fruitset)
fruitset.add("apple")
fruitset.add("elderberry")
print(fruitset)
fruitset.update(["apple","apple","apple","strawberry","strawberry","apple","mango"])
print(fruitset)
# remove()
fruitset = {"apple", "banana", "cherry", "durian", "mango"}
print(fruitset)
fruitset.remove("apple")
print(fruitset)