Why is 'gold' wrong please help. Says syntax error


#1

inventory = {'pocket' : ['seashell', 'strange berry', 'lint']
'gold' : 500, 50
'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']
}


#2

first create the dictionary, then later manipulate the value:

inventory = {'pocket' : ['seashell', 'strange berry', 'lint']
'gold' : 500
'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']
}

# now manipulate the gold:
inventory['gold'] = "update the gold here"

#3

inventory = {'pocket' : ['seashell', 'strange berry', 'lint']
'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['backpack'].sort()
inventory['backpack'].remove('dagger')
inventory['gold'] = 500,50


#4

if i do math involving numbers, to add two values together i use +, why would you use ,?


#5

All it says is this

Oops, try again. Did you accidentally delete the inventory dictionary? Click Reset Code to get back to the original code.


#6

please post an updated version of your code with format:

so indent in your code shows


#9

inventory = {'pocket' : ['seashell', 'strange berry', 'lint']
    'gold' : 500,
    'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
   'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']
}

#11

Your code is okay, Now You can follow instructions and move ahead.
Give a reading to instructions and if you get problem understanding that, point them out, We will explain!


#12

@stetim94, I believe OP was trying to append the value to 'gold' instead of adding to it.

@tollyboy101, the new value of 'gold' should be 550. In order to make it so, you must add 50 per instruction:

The following link has a great example of how to solve this by @stetim94 (https://discuss.codecademy.com/t/dangerous-to-go-alone-take-this/146478/6?u=nahuatl19650)


#13

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.