WARNING: This program has a logic error that is causing a syntax error!

RULE: Variables created inside a function cannot be used outside the function. They have a local scope, meaning they only exist (and therefore can only be used) within the function that creates them!

  • Click Run and read the error message. name 'planet' is not defined on line 11, outside the function!
  • Change the variable planet on line 11 to the string "Jupiter" so the alien tells you how long he's lived there!

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)