Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
confusion with hashable
#4
Hi Sir, thank you for helping me out, am I very happy now, but for this.

'''tuple inside set'''
s = {(1, 2), (1, 2)}
print(s[0][1])
Output:
TypeError 'set' object is not subscriptable
I am good here, because with set, we can't predict the order, we may not use it

here is problem

''list inside set'''
s = {[1, 2, 3], [3, 4, 5]}
print(s[0])
Output:
TypeError: unhashable type: 'list'
here I am using set only, but I think, I should get the same output as ago, why is it complaining about list?
Reply


Messages In This Thread
confusion with hashable - by spalisetty06 - Aug-20-2020, 02:41 PM
RE: confusion with hashable - by buran - Aug-20-2020, 02:46 PM
RE: confusion with hashable - by spalisetty06 - Aug-20-2020, 03:40 PM
RE: confusion with hashable - by spalisetty06 - Aug-21-2020, 01:11 PM
RE: confusion with hashable - by ndc85430 - Aug-21-2020, 02:27 PM
RE: confusion with hashable - by deanhystad - Aug-21-2020, 07:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  hashable confusion spalisetty06 3 2,030 Aug-16-2020, 03:54 PM
Last Post: spalisetty06

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020