QUOZR    BADGZ
   GUEST               
PYTHON PROGRAMMING - PART 2 (BUILDING)
Modulo
Lists
For Loops
While Loops
Loops Break
You are not signed in. Sign In or Sign Up
You can still take all the badges though and simply show or submit your work anyway you please!
   YOU ARE NOW WORKING ON : MODULO
INSTRUCTIONS  

 

The Modulo function in programming is an important and often used code.
It is used in areas such as barcodes to check for errors.

Modulo returns the remainder when one number is divided by another

For example

10 modulo 4 = 2
10 modulo 5 = 0
17 modulo 8 = 1
12 modulo 4 = 0

In Python we use the % sign to denote a modulo calculation

10 % 4 = 2
10 % 5 = 0
17 % 8 = 1
12 % 4 = 0

This can also be useful if we want to check if a number is odd or even.
Using modulo 2 will always bring back 0 for even numbers.


 

 



CLAIM THIS BADGE

Now you know how Modulo works

Create a programme that asks for 2 numbers
Output to the user whether or not the first number is ODD or EVEN - do the same for the second number
Output the Calculated Modulo value for these 2 numbers
Include messages to the user exactly what you output means - explain everything.
Don't forget to comment on your code.

Submit your work