14 in python lists and dictionaries. HELP PLEASE


inventory[‘Pocket’] = [‘seashell’, ‘strange berry’, ‘lint’]
backpack[‘gold’] = 50

the error message:
Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: list.remove(x): x not in list


@ammar847: That’s because “dagger” is not on your dictionary and such won’t be able to be removed.
Check the instructions and see whether your dictionary or item to be removed is incorrect.


Here is my code:
but I am not satisfied with the last line (Add 50 to the number stored under the ‘gold’ key), could you share yours with me?

inventory[‘pocket’]=[‘seashell’, ‘strange berry’, ‘lint’]


that is definitelly not 50 :slight_smile:
you can assign 50 like this:

inventory['gold'] = 50

or you can add 50 to the number alrady in ‘gold’:

inventory['gold'] += 50