- 1

# Code coach "popsicles"

So im new to this and don't get it i tried inputting what i think they ask but am not getting through. Maybe i don't understand what they want me to code i am currently trying to use swift.

22nd Dec 2019, 8:35 AM
Corey Powell
+ 3
You can try the if - else case for that problem.
23rd Dec 2019, 3:46 PM
+ 8
they want you to code a program that can get two input, and then determine the output based from the input. There are two outputs, which are: 1) if the popsicles can be given equal to each sibling, the output is "give away" 2) if the popsicles can't be given equal to each sibling, the output is "eat them yourself" after you have complete the code, then open the third tab, where sololearn program will test your code 5 times with their own input. if all of the test giving the same output as expected, then you have completed the challenge and got 10xp
22nd Dec 2019, 10:22 AM
Amethyst Animion
0
I also don't understand how to get the formula your puting in the code to make these outputs even possible lol idk im lost
22nd Dec 2019, 10:25 AM
Corey Powell
0
Tacklebiscuit hi there,try print (“eat them yourself”) and (“give away”) so it wont be giving errors i’ve passed 4 tests but can’t get away with the 5th can u please take a look at my code? siblings = int(input()) popsicles = int(input()) #your code goes here answer=popsicles/siblings answer=answer%2 if answer==0: print ("give away") #elif popsicles or siblings ==0: #print ("eat them yourself") else: print ("eat them yourself")
26th Jan 2020, 6:53 PM
Salwa
0
Salwa try: siblings==popsicles
24th Feb 2020, 5:31 AM
gdlfr
0
hey👋🏻ive already solved it ,ugh i always tend to make everything complex when the answer is just so simple 😅 but thanks anyways😁
22nd Mar 2020, 5:57 PM
Salwa
0
logic is if (popsicles%siblings == 0) it can be divided among the siblings use this logic in your syntax of swift hope for the results😊 This is solution in c++ :- #include <iostream> using namespace std; int main() { int siblings, popsicles; //take input cin>>siblings>>popsicles; //your code goes here if((popsicles%siblings)==0) cout<<"give away"; else cout<<"eat them yourself"; return 0; }
2nd Apr 2020, 10:03 AM
Saiyam Jain
- 3
Is this even close?!?! siblings = int(input()) popsicles = int(input()) def siblings % popsicles = return if (int) print "siblings" else print "eat em myself"
25th Jan 2020, 7:06 PM
Tacklebiscuit