STEP 17: The computer says there's a ValueError. Let's change the error message to make it more user-friendly.

A value error is thrown when the computer receives a variable with a data type it wasn't expecting.

  • Inside handle_user_errors(), change the variable name Exception to ValueError.
  • In the print statement underneath the except: change e to "ERROR: Please enter an integer."
  • This new feedback explains how to fix an error caused by an unexpected data type inputted by the user.

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)