14/14 How to Add 50 to the number stored under the 'gold' key?

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

}

inventory[‘burlap bag’] = [‘apple’, ‘small ruby’, ‘three-toed sloth’]
inventory[‘pouch’].sort()

inventory[‘pocket’]=[‘seashell’,‘strange berry’,‘lint’]
inventory[‘backpack’].sort()
inventory[‘backpack’].remove(‘dagger’)
inventory[‘gold’]=50
print inventory

Oops, try again. Make sure to add 50 to the gold total!

1 Like

I made it this way:
inventory[‘gold’] = 550

1 Like

:joy: :joy: :joy: :joy: :smile: :smile: :smile: :smile: :grinning: :grinning: :grinning: :grinning:

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

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
print inventory

1 Like

QUESTION:

Why is that ((( inventory [‘gold’] = 500 +50 ))) is written this way and not
this way [ 500 + 50 ]?

Thank you

Syntax error:

File “python”, line 15
inventory[‘gold’]+=50
^
SyntaxError: invalid syntax