[solved]It's Dangerous to Go Alone, Take this! Syntax error adding gold?


#1

False alarm. I’m an idiot, I’ve just solved this. I typed backpack.sort() instead of inventory[backpack].sort()…

https://www.codecademy.com/courses/python-beginner-en-pwmb1/2/5?curriculum_id=4f89dab3d788890003000096

ERROR MESSAGE:

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

This should add 50 to the ‘gold’ value. How can I phrase this to fix syntax? My code is below.

```python

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’]

backpack.sort()
inventory[‘backpack’.remove(‘dagger’)
inventory[‘gold’] = inventory[‘gold’] + 50

<do not remove the three backticks above>

#2