14/14 Its Dangerous to go Alone


#1

PLEASE HELP ME

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

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

Error: Oops, try again. Did you accidentally delete the inventory dictionary? Click Reset Code to get back to the original code.
BUT I DIDNT DELETE THE ORIGINAL CODE!!! Is it a glitch or something, and I should just skip the lesson?!


#2

Never mind I figured it out :wink:


#3

@3rachel
could you please post your code


#4

Here @wambuiwanjiru :

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']
inventory['pocket'] = ['seashell', 'strange berry', 'lint']
inventory['backpack'].sort()
inventory['backpack'].remove('dagger')

Sorting the list found under the key 'pouch'

inventory['pouch'].sort()
inventory['gold'] += 50

I realized that I had actually changed the original code for the ['gold'], and that I was supposed to add it with inventory['gold'] += 50 instead :wink:


#5

Thanks.Am now able to run it


#6

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