Error in lesson (It's Dangerous to Go Alone! Take This)


#1

Dear Sir,
I just got error again on this below code. I did all correct code but it gives me add value 50 to key "gold" which i did. But still it gives me error.......(Oops, try again. Make sure to add 50 to the gold total!)

Below is my Code

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","strange berry","lint"]
inventory["backpack"].sort()
inventory["backpack"].remove("dagger")
inventory["gold"]=[500,50]

Thank to help me on this issue also please. I just use these code which are working in repl.it workplace but codecademy workplace didn't accept my code.So, thank to help as usual.

My regards,
TBIKU


#2

'gold' has a value, 500. We need to add 50...

inventory['gold'] += 50

#3

@mtf
Thank you boss. It works for me. I think wrong concept. Sorry, to brother you.

regards,
TBIKU


#4

Mine keeps saying:
File "python", line 3
'gold' : [500]
^
SyntaxError: invalid syntax

What's invalid?


#5

Not enough information for us to indicate what the actual error is. We should note, though, that the value is a number, not a list.

'gold': 500,

#6

yeah that was the problem, thanks.


#7

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