5.1 KiB
5.1 KiB
In [ ]:
x = set()In [ ]:
# We add to sets with the add() method
x.add(1)In [ ]:
#Show
xIn [ ]:
# Add a different element
x.add(2)In [ ]:
#Show
xIn [ ]:
# Try to add the same element
x.add(1)In [ ]:
#Show
xIn [ ]:
# Create a list with repeats
list1 = [1,1,2,2,3,4,5,6,1,1]In [ ]:
# Cast as set to get unique values
set(list1)In [ ]:
# Set object to be a boolean
a = TrueIn [ ]:
#Show
aIn [ ]:
# Output is boolean
1 > 2In [ ]:
# None placeholder
b = NoneIn [ ]:
# Show
print(b)In [ ]:
In [ ]: