STEP 5: Time to try casting a spell! We'll need to start calling functions to see them work.

  • From , drag Function Call with Parameter to the bottom of the MAIN CODE section.
  • Change my_function to cast_spell. Change the parameter in the parentheses from my_var to player.

We need to pass an argument to cast_spell() because its function definition includes a parameter named caster. Passing in player to this function allows it to determine who is casting a spell, the player or the computer.

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)