0

I want to convert this nested list into a set:

[[1, 2], [3, 4]]

What I've tried:

a = [[1, 2], [3, 4]]
b = set(a)
print(b)

Result:

Traceback (most recent call last):
  File "C:/Users/Caitlin/Desktop/p.py", line 2, in <module>
    b = set(a)
TypeError: unhashable type: 'list'

Desired result:

{[1, 2], [3, 4]}

Can someone tell me a basic way to how it's done?

0 Answers0