Did you accidentally delete the inventory dictionary


#1

Your code here

inventory ["pocket"]
inventory ["pocket"] : ["seashell", "strange berry", "lint"]
backpack.sort()
backpack.remove("dagger")
gold += 50

Oops, try again. Did you accidentally delete the inventory dictionary? Click Reset Code to get back to the original code.
What is wrong with my code? TNX


14. It's Dangerous to Go Alone! Take This
#2

gold is a member of inventory, so needs to be referred as such:

inventory['gold'] += 50

#3

I have the same problem. I saw what you did and that's what I did. Its still isn't working. Can you help?

Here's the code:
inventory = {
'gold' : 500,
'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']
}

Adding a key 'burlap bag' and assigning a list to it

inventory['burlap bag'] = ['apple', 'small ruby', 'three-toed sloth']

Sorting the list found under the key 'pouch'

inventory['pouch'].sort()

Your code here

inventory["pocket"] : ["seashell", "strange berry", "lint"]

inventory["backpack"].sort

inventory["backpack"].remove("dagger")

inventory["gold"] += 50

Here's the error:
File "python", line 14
inventory["pocket"] : ["seashell", "strange berry", "lint"]
^
SyntaxError: invalid syntax

And this is what codecademy says:
Oops, try again. Did you accidentally delete the inventory dictionary? Click Reset Code to get back to the original code.


#4

Hi this line

inventory["pocket"] : ["seashell", "strange berry", "lint"]

instaed of : put =


#5

it worked thx for the help