Home › Course contents › Level 7: Snack Time
Changing variables
Level 7: Snack Time
Chapter 1 · Starter Village
What's inside a name tag can be swapped out:
hp = 50 # HP is 50 right now
hp = hp + 10 # take the old HP, add 10, put it back
print(hp) # your partner says 60
hp = hp + 10 looks a little odd. Read it as: "the new hp equals the old hp plus 10".
GoalFeed 3 snacks in total so HP becomes 80.
TipCopy the line hp = hp + 10 to feed one more snack.
Starting code
hp = 50
# Feed 3 snacks: write one line hp = hp + 10 for each snack
# Finally, say hp