+ 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))
6 Antworten
+ 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
+ 4
And I know I also thought it would round up even 3.3 to 4 but it works anyway lol!
+ 4
I just used round on my code and I failed 3rd test like you ,😂
+ 2
Maybe replace round with Math.ceil
+ 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)
+ 1
Thanks everyone.
I really appreciate.