I need help on the popsicle challenge. 4/5 right. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need help on the popsicle challenge. 4/5 right.

The input is two integers, the first one represents the number of siblings, and the second one represents the number of popsicles. The output should say “give away” if I can give them away evenly to the siblings, and “eat them to yourself” if I can’t give them out evenly. When I put 0 in the input for popsicles it says “give away” which doesn’t make sense because you can’t give away 0 popsicles. I don’t know how to fix that. https://code.sololearn.com/cK7MRqqLD1wZ/?ref=app

10th Dec 2021, 11:36 PM
Saja
3 Answers
+ 2
If the number of popsicles doesn't divide equally among the siblings, then eat them yourself otherwise give them away. Basically if 'rem' is not equal to 0 then eat them if it is then give them away. The 1 check in 1 if statement is all you need.
10th Dec 2021, 11:53 PM
ChaoticDawg
ChaoticDawg - avatar
+ 3
ChaoticDawg thank you
11th Dec 2021, 12:02 AM
Saja
+ 1
popsicles%siblings==0
20th Dec 2022, 5:09 AM
Cristian Baeza Jimenez
Cristian Baeza Jimenez - avatar