Set, Set In Python, Python Programming, Data Science, Artificial Intelligence.
random delete any element. clear() method: used to remove all elements from a set, making it an empty set. # Creating a set s = {1, 2, 3, 4, 5} # Clearing all elements from the set s.clear() #Output set() Operation Performed on Set Data type: s1 = {1,2,3,4,5} s2 = {4,5,6,7,8} # Union(|) s1 | s2 #