Home

Adding a list to a set

you cannot add a list to a set!!

s = set()
seq = [1, 2, 3]

s.add(8)
print(s)
>> {8}

s.add(seq)  
>> TypeError: unhashable type: 'list' 
Tags: Python, Set, List