Hi guys i tried to do the paint cost challenge. but i got all the test case except the third one. My code i in the description. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Hi guys i tried to do the paint cost challenge. but i got all the test case except the third one. My code i in the description.

paint = int(input()) colour = paint * 5 canvas = 40 tax = (colour+canvas)/100*10 total_cost = colour+canvas+tax print (round(total_cost))

16th Apr 2020, 10:55 PM
Olufemi Tofunmi
Olufemi Tofunmi - avatar
6 Answers
+ 4
I have used Math.ceil and it works for me ,maybe since I used round only before and wasn't able to pass all tests
16th Apr 2020, 11:39 PM
Abhay
Abhay - avatar
+ 4
And I know I also thought it would round up even 3.3 to 4 but it works anyway lol!
16th Apr 2020, 11:40 PM
Abhay
Abhay - avatar
+ 4
I just used round on my code and I failed 3rd test like you ,😂
16th Apr 2020, 11:43 PM
Abhay
Abhay - avatar
+ 2
Maybe replace round with Math.ceil
16th Apr 2020, 11:05 PM
Abhay
Abhay - avatar
+ 2
The challenge says round up. Using round() would round it either down(3.3 --> 3) or up(3.7 --> 4) depending on the value. Using math.ceil rounds it up irrespective.(3.3 or 3.7 -->4)
16th Apr 2020, 11:14 PM
Justus
Justus - avatar
+ 1
Thanks everyone. I really appreciate.
17th Apr 2020, 7:02 AM
Olufemi Tofunmi
Olufemi Tofunmi - avatar