+ 1

What's wrong with my code

It's a code challenge. At Easy level . Name paint cost https://code.sololearn.com/ciCPBLHJ851V/?ref=app

9th Nov 2020, 5:08 PM
Vral Vyas
7 Réponses
+ 12
Nikolai Ivanov , as you mentioned that the cost for your purchase has to be rounded UP, the round() function is not the appropriate tool. Rounding UP correctly (to the next higher whole number) can be done with math.ceil() but not with round(). round(7.4) -> 7 round(7.6) -> 8 ------ ceil(7.4) -> 8 ceil(7.6) -> 8
9th Nov 2020, 6:29 PM
Lothar
Lothar - avatar
+ 5
Nikolai Ivanov , Vral Vyas , i did this coach code exercise some months ago using ceil(). It passed all cases. So if it fails, there must be an other problem.
10th Nov 2020, 11:57 AM
Lothar
Lothar - avatar
+ 2
Output Format A number that represents the cost of your purchase rounded up to the nearest whole number. You need round up the cost. Example: int(0.7) = 0 round(0.7) = 1
9th Nov 2020, 5:24 PM
Nikolai Ivanov
Nikolai Ivanov - avatar
+ 1
cost = round (price + price/10)
9th Nov 2020, 5:15 PM
Nikolai Ivanov
Nikolai Ivanov - avatar
+ 1
Right answer . But I have to use round
9th Nov 2020, 5:18 PM
Vral Vyas
+ 1
Lothar, but with function math.ceil() tests failed.
10th Nov 2020, 5:21 AM
Nikolai Ivanov
Nikolai Ivanov - avatar
0
No I try it .it work as ok as round ()
10th Nov 2020, 6:56 AM
Vral Vyas