0

Popsicle test - all clear except test case 5, which I can't view

I don't have premium. Here's my code, what could I be missing? siblings = int(input()) popsicles = int(input()) #your code goes here if (popsicles/siblings) %2 == 0: print("give away") elif (popsicles/siblings) == 0: print("give away") else: print("eat them yourself")

2nd Jun 2023, 2:19 PM
Heather McLinton
7 ответов
+ 5
I think you can simplify the code by using popsicles % siblings If there are 0 remaining, you can give them away. If it is any other number remaining, you keep them for yourself.
2nd Jun 2023, 2:26 PM
Lisa
Lisa - avatar
+ 3
If input is 5 15 Then should output "give away". You can give 3 popsicles to each sibling.. 5*3=15 => 15%5==0
2nd Jun 2023, 2:45 PM
Jayakrishna 🇮🇳
+ 2
Mc Rey Pangandoyon Quiao Please do not give ready-made code. Rather help the OP to find their own solution.
3rd Jun 2023, 7:35 PM
Lisa
Lisa - avatar
+ 1
Side note, the original logic wasn't just excessively complicated, it flat out didn't work. Even ignoring the problems caused by integer division (which are always numerous), 15 popsicles for 5 siblings (or any other situation with an odd multiple) would tell you to eat them yourself. In fact though, performing integer division specifically eliminates the remainder, so even with otherwise good logic it would tell you to always share (which isn't the worst idea in practice lol)
2nd Jun 2023, 5:50 PM
Orin Cook
Orin Cook - avatar
0
Apparently! I didn't do anything to cause this, just copy-pasted
2nd Jun 2023, 2:21 PM
Heather McLinton
0
Iam also bro same copy paster
2nd Jun 2023, 2:22 PM
TAITIKES RAI
TAITIKES RAI - avatar
0
Ahah, that makes sense! Thanks!
2nd Jun 2023, 3:15 PM
Heather McLinton