MATH: Python has a special math operator called modulo that returns the remainder of division. The operator is %.

Modulo returns the remainder of division. For example, 5 % 2 is equal to 1 and 8 % 2 is equal to 0.

  • Drag Remainder into the program at the bottom. Change the variable my_var to modulo.
  • Change the numbers used in the modulo equation. Click Run and then try other numbers to test it out.
  • What will be the answer to this: 20 % 6? Put those numbers in and click Run to find out!

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)