+ 18
You can make it a tad shorter with print("eat them yourself" if popsicles % siblings else "give away") 😉
12th Jan 2020, 5:30 AM
David Ashton
David Ashton - avatar
+ 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)])
12th Jan 2020, 4:15 PM
Erialdo Meta 🇦🇱
Erialdo Meta 🇦🇱 - avatar
12th Jan 2020, 11:50 AM
David Ashton
David Ashton - avatar
+ 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
14th Jan 2020, 3:45 AM
David Ashton
David Ashton - avatar
+ 3
Your code should look like: https://code.sololearn.com/c6Oiqd1G52z2
12th Jan 2020, 1:28 AM
John Wells
John Wells - avatar
+ 2
Sorry, missed the fact you had the modulo operation backwards. Updated my code.
12th Jan 2020, 2:59 AM
John Wells
John Wells - avatar
+ 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.
13th Jan 2020, 10:13 PM
Anthony B.
Anthony B. - avatar
+ 1
Petal[]Keys sorry I redacted the dictionary and now it should work.
12th Jan 2020, 4:31 PM
Erialdo Meta 🇦🇱
Erialdo Meta 🇦🇱 - avatar
0
Delete line 3 and remove indents. Replace line 9 to 11 with: 'else:'.
12th Jan 2020, 1:04 AM
John Wells
John Wells - avatar
0
siblings = int(input()) food = int(input()) if food % siblings == 0 and food>=siblings : print("give away") else : print("eat them yourself")
5th Jun 2020, 7:18 AM
Ritchie Pulikottil
Ritchie Pulikottil - avatar