DEV Community

loading...

Discussion on: January 22nd, 2021: What did you learn this week?

Collapse
learnbyexample profile image
Sundeep

Until I tried today, I didn't know set data type in Python doesn't accept mutable types as an element!!

>>> {1, 3, [1, 2], 4}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'

>>> {1, 3, (1, 2), 4}
{3, 1, (1, 2), 4}
Enter fullscreen mode Exit fullscreen mode