Python, Data Science, Data Engineering, Programming, Coding.
set2 = set([1,2,3,4,5]) # Adding an item to a set set1.add(6) # Removing an item from a set set1.remove(6) # iterating over a set for item in set1: print(item) # Remove duplicates from a list lst = [1,2,3,4,5,5,5,5,5,5,5,5,5,5,5,5] set(lst) lst = list(set(lst)) # Sets do not support item assignment