Answer the question
In order to leave comments, you need to log in
Why does Python throw an unhashable type: 'dict' error?
Python throws an error unhashable type: 'dict'
.
Here is the code that is causing the problem:
def delete_product(user_group, shop = shop, **products):
if user_group in shop:
shop[user_group].pop(products)
Answer the question
In order to leave comments, you need to log in
You are trying to use a non-hashable type as a key in the dictionary (in this case, judging by the error, the user_group dictionary is also).
A dictionary key can only be a hashable type, such as a tuple (no nested non-hashable elements), a string, a number, and so on.
Please treat the people on this resource with respect: format the code with tags and include the full stack trace of errors.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question