What exactly is the mistake I'm making here?
Hello @arraywhiz39529, did you look at the error on line 18 of your code? Look at
inventory['gold'], since it holds
500, you can't assign
50 to it (as the error tells). You should reread instruction #5.
Thanks for taking the time to reply me.
Strangely, I changed the value of gold inside inventory dictionary and it worked.
I'm still trying to figure out if I can update or add to existing values in a dictionary
I think i've found a way to do it by doing
inventory['gold']=inventory['gold'] + 50
Although i'm sure I tried that an hour ago and it didn't accept it...
Anyway it seems to work now, hope it helps.
That just worked for me.
is it possible to make it like thins: inventory[‘gold’] += 50
Yes it is.
I just tried it
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.