Hello, Can you tell me what the problem is? Thank you in advance! 😁 x=int(input()) cost=(40+(5*x))*1.1 import math print(math.ceil(cost))
Okay. I figured out what is going on (although I'm not sure why): The input of case 1 is 2. So with this formula cost=(40+(5*x))*110/100 cost is 55. Now this formula returns 55.0 in python. So rounding up makes no difference and all you need to do is convert to int. However when you replace "110/100" with "1.1" there is a precision error resulting in 55.00....01. And rounding that up gives the wrong result.
What exactly do you not like?
Describe the task.
I sent in a bug report detailing the issue. Floating point precision issues should not be a stumbling block in an "easy" code coach.
I don't think rounding up is the problem. But when having rounded up, we still need to make sure that we output as integer. I had solved it with int(ceil(result)) It might be coincidence that in the Python version round() works?
When I submit the upper, I failed in 1st test and I don't know why..
There's a mistake in that particular Code Coach. The task description asks for the result to be rounded *up*. However, to pass the test cases you actually have to use regular rounding.
Lisa weird. When I use math.ceil() the output for case 1 is 56, but the expected output is 55. It works when I use round().
Thank you, all! I am not sure what the difference between 110/100 and 1.1 but when I replace 1.1 with 110/100, it is solved.