I can't tell what is wrong with my code


#1



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() 

# Your code here
inventory ={
    "pocket" :["seashell", "strangeberry","lint"]
    }
inventory['backpack'].sort()
inventory["backpack"].remove("dagger")
inventory ["gold"]+=50

print inventory


<do not remove the three backticks below>
```python


Replace this line with your code. 



#2

look:

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() 

# Your code here
inventory ={
    "pocket" :["seashell", "strangeberry","lint"]
    }
print inventory
inventory['backpack'].sort()
inventory["backpack"].remove("dagger")
inventory ["gold"]+=50

print inventory

you didn't add pocket to inventory, you overwrote your dictionary and pocked is now the only key in your inventory


#3

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