Hello, here is the exercise link:
I have not searched for any solutions in the starting of this Dictionary chapter, but I am trying hard to solve this exercise, but it makes me confusion. Prior to this question, the explanation was something, and the question you are asking in this exercise seems not match with the explanation.
So, my confusion is:
In one line, add the corresponding value of the key
"stamina grains"to the
health_pointsvariable and remove the item
"stamina grains"from the dictionary.
I found the solution as:
health_points += available_items.pop("stamina grains",0)
What is the use of value 20 assigning to the variable health_points ?
Also, why we do something like this?
health_points += available_items
Can’t we just write as:
health_points = available_items