14. Its Dangerous to Go Alone! Take This


#1

I tried every helps in the forum and its not working.

Thta's my 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'] = 550

I have two reports:
1- File "python", line 4
'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']
^
SyntaxError: invalid syntax

2- "Did you accidentally delete the inventory dictionary? Click Reset Code to get back to the original code."

I have tried a lot of times and compare my code with the helps in the forum and dont works.

Somebody help me please?


#2

I got the same error until I added a comma after the brackets of 'backpack'


#3

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

You just put a colon instead of an equal sign in between pocket and seashell:

inventory['pocket'] = ['seashell', 'strange berry', 'lint']