+ 1

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. 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. Sample Input 3 9 Sample Output give away _____ my code ______ s = int(input()) p = int(input()) if((p-s) < 10): print ("eat them yourself") else : print ("give away") _______ but not work ____ 4/5 is done

10th Feb 2022, 11:42 AM
Shai Shab
Shai Shab - avatar
4 ответов
+ 2
# Hi! You can compare your solution with this one: s, p = int(input()), int(input()) print("eat them yourself" if p%s else "give away")
10th Feb 2022, 11:45 AM
Per Bratthammar
Per Bratthammar - avatar
+ 3
Please read carrefully the task description again and think about the if statement over. Unfortunately this does not reflect the requirement.
10th Feb 2022, 11:46 AM
JaScript
JaScript - avatar
0
hello
10th Feb 2022, 10:47 PM
SFWANIR DSA
SFWANIR DSA - avatar
0
You have to use the modulo and check if the modulo is 0 Eg : if s % p == 0 : print("give") else : print("eat")
16th Feb 2022, 12:13 AM
Gurseerit Singh Chahal ✓
Gurseerit Singh Chahal ✓ - avatar