+ 4

[SOLVED] Why this test cases becomes false everytime??

Actually I just try to solve paint costs problem. I tried this in Python and C language. In both, Case 1,2 and 5 are solved. But everytime case 3 and 4 becomes false. What's wrong here?, I cannot understand this. Here is the code in python: a = int(input()) sum = a*5 + 40 tax = int(sum/10) total = sum + tax print(total) Thanks!!

18th Dec 2020, 2:08 PM
axita
axita - avatar
3 Réponses
+ 4
it says rounded "up" to the nearest whole number ,so you need to use ceil method of math class for that purpose a = int(input()) sum = a*5 + 40 import math tax = math.ceil(sum/10) total = sum + tax print(total)
18th Dec 2020, 2:19 PM
Abhay
Abhay - avatar
+ 5
19th Dec 2020, 8:33 AM
axita
axita - avatar
+ 3
Here is the code in python: a = int(input()) sum = a*5 + 40 tax = sum/10 total = sum + tax print(round(total)) Thanks!!
18th Dec 2020, 6:33 PM
Hüseyin Emre Gözen
Hüseyin Emre Gözen - avatar