Something wrong with 'backpack'


1 inventory = {
2 'gold' : 500,
3 'pouch' : ['flint', 'twine', 'gemstone'], # Assigned a new list to 'pouch' key
4 'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']
7# Adding a key 'burlap bag' and assigning a list to it
8inventory['burlap bag'] = ['apple', 'small ruby', 'three-toed sloth']
10# Sorting the list found under the key 'pouch'
13inventory = {'pocket': ['seashell', 'strange berry', 'lint']}
16inventory['gold'] += 50

im being told that there is something wrong with 'backpack' on line 14 & 15, can anyone see what it is because I sure cant

ps the numbers aren't in the code they are just to see what line the code is on

Did you accidentally delete the `inventory` dictionary? Click Reset Code to get back to the original code

The above is re-defining inventory, effectively wiping out everything that was previously in it.

inventory['pocket'] = ['seashell', 'strange berry', 'lint']


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