Set in Python
thisset = {"apple", "banana", "cherry", True,1, 1, 2}
li=set((True,12,'c',"Blue"))
print(thisset)
print(len(thisset))
print(type(thisset))
print(type(li))
li.update(thisset)
li.add("Orange")
# li.remove("Orange1") # remove method raises an error if the element is not in present the set
# li.discard("apple") # discard method does not raises an error if the element is not present in the set
li.pop() # removes the last element in the set
li2=frozenset(("Gunjan",'N',22,76.5,True))
print(li2)
print(type(li2))
print(li)
Comments
Post a Comment