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")
5 odpowiedzi
+ 1
You have to show us your attempt, only then can we be sure!
+ 1
Ready
+ 1
What are your first two lines supposed to do? Can you explain?
+ 1
it should look like this:
siblings = int(input())
popsicles = int(input())
if popsicles % siblings ==0:
print ("give away")
else:
print ("eat them yourself")
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