+ 18
You can make it a tad shorter with
print("eat them yourself" if popsicles % siblings else "give away")
😉
+ 8
Or you could use just two lines in python using boolean as key in dictionary:
sib,pop = int(input()), int(input())
print({True: "give away", False: "eat them yourself"} [(pop%sib==0)])
+ 6
Anthony Brown I don't know your solution for Halloween Candy, but there is a simple one for that too 🙂
https://code.sololearn.com/c2LuLrKwsR1z
+ 3
Your code should look like:
https://code.sololearn.com/c6Oiqd1G52z2
+ 2
Sorry, missed the fact you had the modulo operation backwards. Updated my code.
+ 2
The answer seems so simple on this thread. I was doing more than necessary, adding numbers and equations that didnt need to be. You guys are awesome.
+ 1
Petal[]Keys sorry I redacted the dictionary and now it should work.
0
Delete line 3 and remove indents. Replace line 9 to 11 with: 'else:'.
0
siblings = int(input())
food = int(input())
if food % siblings == 0 and food>=siblings :
print("give away")
else :
print("eat them yourself")



