What is causing the error in the code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is causing the error in the code?

My answer to the Popsicle coding puzzle is not working. Can you please help me figure out what is wrong? N.B. Probably a lot of things wrong as I'm coming back to coding python after 3 years. I'm a little rusty. Please have some patience, I could really do with the help! Puzzle: Popsicles You have a box of popsicles and you want to give them all away to a group of brothers and sisters. If you have enough left in the box to give them each an even amount you should go for it! If not, they will fight over them, and you should eat them yourself later. Task Given the number of siblings that you are giving popsicles to, determine if you can give them each an even amount or if you shouldn't mention the popsicles at all. Code: siblings = int(input()) popsicles = int(input()) #your code goes here n= int(int(popsicles) % int(siblings) ) if int(n) == 0: print 'give away' not: print 'eat them yourself'

4th May 2020, 12:09 PM
Rose Whitica
Rose Whitica - avatar
2 Answers
+ 2
In the playground, it is Python 3. The brackets for the print-function are required. And the 'not' should be an 'else', I think...
4th May 2020, 12:15 PM
Lisa
Lisa - avatar
+ 1
Thank you, you've helped me solve it!
4th May 2020, 12:40 PM
Rose Whitica
Rose Whitica - avatar