Cant get right output!


#1



Its Dangerous to go alone ! Take This


Error : Did you sort inventory['backpack']

The code should be accepted and take me forward to the next topic !

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


#2

Remove this two lines.

Instead, you need to add 50 to the inventory of gold, like this:

inventory['gold'] += 50;

:slight_smile:


#3

Thanks . It works finally :slight_smile:


#4

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