0

Paint Costs Code Coach

I think the description of the challenge is a bit misleading. It says "round up to the next integer number" but if I use math.ceil() I cannot pass all tests. Conversely, if I use the simple round() function I solve the challenge. The round() is not rounding up to the next integer number unless the decimal is higher than 6 or the decimal is .5 and the next integer is an even number. From the description I understand costs must be rounded up to the next integer regardless of the decimal.

1st Sep 2024, 9:47 PM
Ruben
3 Réponses
+ 2
Ruben , can you please link your current code here?
2nd Sep 2024, 5:43 AM
Lothar
Lothar - avatar
+ 1
I used math.ceil() and passed all test cases. How you did calculate the cost?
2nd Sep 2024, 3:03 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
https://www.sololearn.com/coach/22?ref=app This is the version that passes all tests. My previous version had import math as first line and math.ceil(cost) in the print.
2nd Sep 2024, 1:30 PM
Ruben