+ 5

How do I get good at solving Code Coaches?

I always search for solutions but rarely get them right by myself.

23rd Mar 2020, 7:21 AM
ACID
ACID - avatar
34 odpowiedzi
+ 9
And yeah one problem. When you are comparing two values you must use this == not =.
23rd Mar 2020, 7:29 AM
maf
maf - avatar
+ 12
You may want to redo tutorials and ask specific questions here about what you don't understand.
23rd Mar 2020, 10:09 PM
Sonic
Sonic - avatar
+ 7
ALEXCODES u are literally on the point of solving it, just one problem. INDENTATION, CORRECT: if: else: WRONG if: else:
23rd Mar 2020, 7:26 AM
maf
maf - avatar
+ 7
Please remove irrelevant tags. If you feel down, talk to a friend or counsellor.
23rd Mar 2020, 10:08 PM
Sonic
Sonic - avatar
+ 6
One more detail: the program should print out "give away" instead of "give way". Find one more discrepancy yourself ;)
25th Mar 2020, 4:30 AM
Alexander Koval🇧🇾
Alexander Koval🇧🇾 - avatar
+ 5
shouldn't it be popsicles%siblings?
23rd Mar 2020, 7:40 AM
nichdiomajadoch
+ 4
My code is up there
23rd Mar 2020, 7:25 AM
ACID
ACID - avatar
+ 4
You dont need elif coz there are only two conditions so if else is ok.
23rd Mar 2020, 7:27 AM
maf
maf - avatar
+ 3
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
23rd Mar 2020, 7:23 AM
ACID
ACID - avatar
+ 3
Thanks
23rd Mar 2020, 7:29 AM
ACID
ACID - avatar
+ 3
Still gives error
23rd Mar 2020, 7:30 AM
ACID
ACID - avatar
+ 2
Post a challenge with your solution here so that we may help.
23rd Mar 2020, 7:22 AM
maf
maf - avatar
+ 2
siblings = int(input()) popsicles = int(input()) ty = siblings % popsicles if ty = 0 : print("give way") elif ty != 0 : print("eat them myself")
23rd Mar 2020, 7:26 AM
ACID
ACID - avatar
+ 2
File/usercode/python0
23rd Mar 2020, 7:31 AM
ACID
ACID - avatar
+ 2
siblings = int(input()) popsicles = int(input()) ty = siblings % popsicles if ty == 0 : print("give way") elif ty != 0 : print("eat them myself")
23rd Mar 2020, 7:35 AM
Justus
Justus - avatar
+ 2
Change the indentation of ur elif. And "==" is for comparison no "="
23rd Mar 2020, 7:35 AM
Justus
Justus - avatar
+ 2
Neither did i. 👍
23rd Mar 2020, 7:46 AM
Justus
Justus - avatar
+ 2
I have solved two from the easy level Handcrafts and popsicles challenges you can check my code it's here https://code.sololearn.com/crBj1SmPjAXz/?ref=app And this is second one https://code.sololearn.com/c6DyPul28GNv/?ref=app Up vote if you like it
23rd Mar 2020, 3:21 PM
Osama Micro
Osama Micro - avatar
+ 2
YOUR CODE MUST GIVE CORRECT OUTPUT FOR ALL INPUTS.SO YOU SHOULD KEEP TRYING IT.YOU CAN ALSO TRY SOME PROGRAMMING PROBLEMS IN HACKERRANK IF YOU ARE SERIOUS IN CODING.IT WILL MAKE YOU MORE FAMILIER WITH CODE COACH PROBLEMS.
24th Mar 2020, 7:04 AM
Subhadip Das
Subhadip Das - avatar
+ 2
for example if you have 9 popsicles and you want it to divide among 3 people, you will do 9/3 ryt ? and here we are deciding the result by seeing the remaining popsicles.. so the logic should be popsicles % siblings.. try that
24th Mar 2020, 7:45 AM
Sheetal Malavade