EXERCISE 3: This program is hard to read. Let's use functions to organize it and make it easier to read and edit.

  • Create a function named spell_1. Put the commands for the wizard to summon the meteor inside the function.
  • Create a function named spell_2. Put the commands for the wizard to summon treasure inside this function.
  • Create a function named spell_3. Put the commands for the wizard to summon his dragon inside the function.

Think: Once you've created the functions, the spells don't run. Why not? Click Next!

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)