0
Whats wrong with my code
Im just learning python 1week ago so my codes is a mess. All other test cases is right but not the test case #4 Heres the code: siblings = int(input()) popsicles = int(input()) share = (int(popsicles%siblings)) #your code goes here if share%2 == 0 : print ("give away") else: print ("eat them yourself")
2 Respuestas
+ 2
Don't use share%2 ==0
siblings = int(input())
popsicles = int(input())
share= (int(popsicles%siblings))
if share == 0:
print('give away')
else:
print('eat them yourself')
+ 1
Hi John!
Let's say you have 6 siblings and 4 popsicles. So, you can't distribute them among your siblings. But 6%4 = 2; 2%2 = 0.
Your code is giving wrong output for these kinds of inputs. Fot that, you can compare variable share with 0 directly.
If share == 0: