Popsicles | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Popsicles

Sorry, but my code not correct? siblings = int(input()) popsicles = int(input()) if siblings + popsicles <= 7: print('eat them yourself') else: print('give away')

7th Jan 2021, 1:58 PM
Muhammetnyyaz Chopanov
Muhammetnyyaz Chopanov - avatar
2 Answers
+ 7
Read again the problem. What you're doing is adding siblings and popsicle which has no reason to do so. The problem needs to determine if there are extra candies, if there are extra candies, eat the candies so your siblings won't fight, otherwise give it. - - - - - - - - - - - - - - Hint: --> You can use modulus(%) operator to know if there are extra candies For example: I have 20 candies and 2 siblings >> 20 % 2 == 0 # Since the answer or remainder is 0, there is no extra candy and I can give the candies. If you have more questions, feel free to ask. Thanks!
7th Jan 2021, 2:01 PM
noteve
noteve - avatar
+ 2
Thank you!
7th Jan 2021, 3:55 PM
Muhammetnyyaz Chopanov
Muhammetnyyaz Chopanov - avatar