Answer to Question #244692 in Python for Isabel Cortez

Question #244692

4. Leftovers

by CodeChum Admin


We Filipinos are quite known for the habit of leaving at least one of the many pieces of food on the plate as it can't be equally divided among all at most times. Just like when 3 people decide to eat a pizza of 10 slices, there will often be at least one slice left on the box. To accurately show just how many pieces of things are left when divided by a certain number, we code it using modulo.


Care to do it for me?


Input


A line containing two integers separated by a space.


10 3

Output


A single line containing an integer.


1


1
Expert's answer
2021-10-01T03:54:59-0400
# taking multiple inputs at a time(the number of pieces and number of people to devide
#from the user and type casting using list() function
x = list(map(int, input("Enter the number of pieces and the number of people separated by space:\n\t ").split()))

#Now calculate what will be left
remainder = x[0]%x[1]

#Print the number of pieces that will remain
print("number of pieces to remain are :")
print("\t"+str(remainder))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS