- 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.
8 Respostas
+ 3
You can try the if - else case for that problem.
+ 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
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
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")
0
Salwa try:
siblings==popsicles
0
heyđđ»ive already solved it ,ugh i always tend to make everything complex when the answer is just so simple đ
but thanks anywaysđ
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;
}
- 3
Is this even close?!?!
siblings = int(input())
popsicles = int(input())
def siblings % popsicles =
return
if (int)
print "siblings"
else
print "eat em myself"