Sets In Python
# with no duplicate elements. # Basic uses include membership testing # and eliminating duplicate entries. # Set objects also support mathematical operations # like union, intersection, difference, # and symmetric difference. s = set () print ( type ( s )) # Output : <class 'set'> l = [ 1 , 2 , 3 , 4 ] s_from_list = set ( l ) print ( s_from_list ) # Output : {1, 2, 3, 4} print ( type ( s_from_list )) # Output : <class 'set'> s . add ( 1 ) # 1 will be added to empty set s print ( s ) # Output : {1} ...