Oops, try again. Make sure to add 50 to the gold total! [code inside]


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'

# Your code here
inventory['pocket'] = ['seashell' , 'strange berry', 'lint']
inventory['gold'] = [int(inventory['gold']) + 50]

above are my codes, wonders why it doesn't work.

help is much appreciated!


to give a key a new value we can do:

dictionaryName[keyName] = "new value"

but in your case we need to update the value:

example = {"test": "hello"}
example["test"] = example["test"] + " world"

you use too many square brackets, why? If you explain, i can correct your tought process


thanks so much. I really have no reason of using so many brackets. All I thought was to use the function int.(). Probably that is why


but using int() doesn't mean you have to additional square brackets, any way, good that you solved it :slight_smile: