STEP 17: Let's store the value from our last return so that we can use it outside of all the functions.

  • From , drag Subtract Value to the bottom of the program.
  • Change the variable my_var to computer_hp and the value 1 to damage. This subtracts the damage from HP!
  • Drag Update Display to the next line. Change my_display to computer_display and my_var to computer_hp. Click Run and choose a spell. You should now see the computer_hp decrease!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)