0

I'm beginner in Python and I have a problem with exercise of code coach

https://code.sololearn.com/cSGmyl4Kyf14/?ref=app attached my code for you can check and say me which my mistakes

26th Feb 2020, 6:09 PM
Luis Adrian Agúndez Maldonado
Luis Adrian Agúndez Maldonado - avatar
6 Antworten
+ 2
Luis Adrian Agúndez Maldonado the program asks for an input, which is the number of siblings and the number of popsicles. If the number of popsicles can be evenly divided to the siblings, you give them away, else you eat them. In the case of 3 9, you have 3 siblings and 9 pospicles, so if you give them 3 popsicles each you are left with 0. In a general example, the number of siblings is x and number of popsicles is y. If y is divisible by x, then you can give them each an even number of popsicles, else you eat them.
26th Feb 2020, 6:22 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
The 3 9 input was only an example. What you should really check for is if the number of popsicles is divisible by the number of siblings or not.
26th Feb 2020, 6:12 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
I don't understand
26th Feb 2020, 6:17 PM
Luis Adrian Agúndez Maldonado
Luis Adrian Agúndez Maldonado - avatar
0
Firstly, there is nothing wrong with your code, which can work totally. Now may I explain how this works. 1.The required input is 2 integers, the first being the number of your siblings as ss, the second the number of popsicles as pop. 2.In your code, the if statement checks two things: one, whether the number of popsicles is greater than (or equal to) the number of your siblings; two, whether the result of floor division equals common division (if the two results are same, it means you can share all your popsicles with your siblings with each of them having the same amount and nothing left, if the two results doesnt equal, it means you cant divide the popsicles into equal groups and thus you cannot share them). 3.If you can share them ,which means the if statement proves Ture (both things connected by “and” are Ture), you print “give them away”. 4.If you cant, which means either thing connected by “and” is False, the else statement works to print “eat them yourself”. Luis Adrian Agúndez Maldonado
27th Feb 2020, 3:11 AM
QWKKK
QWKKK - avatar
0
Thank you
27th Feb 2020, 3:13 AM
Luis Adrian Agúndez Maldonado
Luis Adrian Agúndez Maldonado - avatar
0
5.A suggestion Your code, where you use “//“ and “/“ works well, but its not that readable. Try using “%” in if statement. Luis Adrian Agúndez Maldonado
27th Feb 2020, 3:14 AM
QWKKK
QWKKK - avatar