What is the difference between add and update operations in python if i just want to add a single value to the set.
a = set() a.update([1]) #works a.add(1) #
add method directly adds elements to the set while the update method converts first argument into set then it adds the list is hashable therefore we cannot add a hashable list to unhashable set.