Hello with exercise popsicles | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello with exercise popsicles

Hello, I made a code with if and% but when I run the program I approve 3 of 5 palette exercises, the question would be how do I let myself pass all the exercises in a single code? siblings = int(2) popsicles = int(5) if popsicles % siblings ==0: print ("give away") else: print ("eat them yourself")

29th Jan 2020, 3:20 PM
Diego Rangel
Diego Rangel - avatar
5 Answers
+ 1
You have to show us your attempt, only then can we be sure!
29th Jan 2020, 3:30 PM
HonFu
HonFu - avatar
+ 1
Ready
29th Jan 2020, 3:48 PM
Diego Rangel
Diego Rangel - avatar
+ 1
What are your first two lines supposed to do? Can you explain?
29th Jan 2020, 4:03 PM
HonFu
HonFu - avatar
+ 1
it should look like this: siblings = int(input()) popsicles = int(input()) if popsicles % siblings ==0: print ("give away") else: print ("eat them yourself")
31st Jan 2020, 10:04 AM
TENENG BRISTINE
TENENG BRISTINE - avatar
0
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. Input Format Two integer values, the first one represents the number of siblings, and the second one represents the number of popsicles that you have left in the box. Output Format A string that says 'give away' if you are giving them away, or 'eat them yourself' if you will be eating them yourself The first two lines are the variables that represent the number of siblings and the number of frozen popsicles
29th Jan 2020, 4:14 PM
Diego Rangel
Diego Rangel - avatar