Please help


#1

My code doesn't work, because of the syntax error on line six. I don't know how to fix it.

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()
inventory['backpack'].sort()
inventory['backpack'].remove('dagger')

Your code here

inventory['gold'] +=50

`


#2

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

what are you doing here?

how to add new key/value pairs to the dictionary after it is created?
remember you learned here

and

Adding a key 'burlap bag' and assigning a list to it
Sorting the list found under the key 'pouch'
Your code here

these line of text should be comment(#)


#3

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