Python Lists and Dictionaries
It's Dangerous to Go Alone! Take This
File "python", line 5
} 'pocket' ['seashell', 'strange berry', 'lint']
SyntaxError: invalid syntax
I have also gotten the error message; Ops, try again. Did you accidentally delete the
inventory dictionary? Click Reset Code to get back to the original code.
If i replace 'pocket' with ['pocket']
i just get this error message:File "python", line 8, in
TypeError: 'tuple' object does not support item assignment
Does anyone know how i fix this code.
I have tried to replace : with =
I have also tried to add commas behind the ]
But nothing work
'gold' : 500, 'pouch' : ['flint', 'twine', 'gemstone'], 'backpack' : ['xylophone','dagger', 'bedroll','bread loaf'], } 'pocket' = ['seashell', 'strange berry', 'lint'], 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'] += 50