Lesson 5

Code the actions you can do with your pet.


In our example, action number 1 is to “Play with” our pet. At this point, we should consider how ‘Playing’ with our pet would affect its variables. Would Happiness go up? What about Hunger and Energy?

We are going to code our “Play” function so that it increases happiness, but decreases our hunger and enegy

The first step will be to set up a print statment that reflects the action we are taking. Copy the code shown on line 19

Now, we want to code how this action will affect our variables. Playing with out pet is going to increase it’s happiness, but lower its hunger and energy. Copy the code from lines 19-22, as seen in the image to the side