d={['R', 'P']:2,['R', 'S']:1,['P','S']:2}
trying to create this list to make the game rock paper scissors but i get an error, TypeError: unhashable type: 'list' looks like the list in the dict makes the error, any solve?
d={['R', 'P']:2,['R', 'S']:1,['P','S']:2}
trying to create this list to make the game rock paper scissors but i get an error, TypeError: unhashable type: 'list' looks like the list in the dict makes the error, any solve?
You cannot use lists as keys in dictionary (or any non-hashable/mutable type). You can use tuples instead
d={('R', 'P'):2,('R', 'S'):1,('P','S'):2}