+ 1

I tried the Haloween Candy. Where is my mistake? Rounding System.

Its in the Code Coach. Its stated that only the first 2 case fulfilled while the other 3 case failed. But i wont show to me what is the 3rd - 5th cases. I tried compraing w calculator and it works well. I cant think what value that failed the code. Is there any way i can see that, or is there any mistake ive done? I made all the var float (double also work). Else, only the 2nd case passes. https://code.sololearn.com/cMYsc7HD8VJh/?ref=app

30th Aug 2020, 5:07 AM
Xtron135
Xtron135 - avatar
5 Respuestas
+ 2
Xtron135 import math print(math.ceil((2/int(input()))*100)) Ceil method
30th Aug 2020, 6:03 AM
Ajith
Ajith - avatar
+ 2
You forget to round Values so. Read instruction properly and see input output format. //ceil means "round up" to the nearest full value. So 200÷3 = 66.666 recurring. //what ceil does is round it up to 67 Hope this will work
30th Aug 2020, 5:35 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
Xtron135 see this So 200÷3 = 66.666 recurring. //what ceil does is round it up to 67 use ceil in result
30th Aug 2020, 5:41 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Ajith i bet that python style. Anyway thanks. I know how to change it to cpp style. thanks so much, it worked.
30th Aug 2020, 7:06 AM
Xtron135
Xtron135 - avatar
0
ཞıɬıƙą ɱıʂɧཞą im not getting what r u saying. So u mean that the question required to "round up" no matter what. ok. now, how to use ceil? 😅
30th Aug 2020, 5:38 AM
Xtron135
Xtron135 - avatar