Find Remainder

Beginner

Welcome to the magical world of mathematics! Today, we're going to learn about remainders. A remainder is what’s left over after division. Imagine you have a group of friendly dragons and you want to share 7 pieces of candy among them equally. But, oh no! There are 5 dragons and when you give each dragon 1 piece, you've used 5 pieces. Now you have 2 pieces left. Those 2 pieces are the remainder!

In Python, you can find the remainder using the % operator. We're going to write a function find_remainder that takes two numbers - the number of items and the number of sharing creatures, and returns how many items are left after sharing them evenly.

Example

find_remainder(10, 3)
  • This will return 1 because 10 divided by 3 gives 3 whole parts with a remainder of 1.
find_remainder(5, 4)
  • This will return 1 because 5 divided by 4 gives 1 whole part with a remainder of 1.
find_remainder(20, 5)
  • This will return 0 because 20 divided by 5 evenly gives 4 parts with no remainder.

Are you ready to help the dragons find out how many candies they have left after sharing? Let's code!

Geek
Inputs

Arg 1:

10

Arg 2:

3
Expected Output
1
Actual Output
Find Remainder [beginner] | Coding for Kids