+ 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!!
3 Respostas
+ 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)
+ 5
Thank you Abhay and Hüseyin Emre Gözen
+ 3
Here is the code in python:
a = int(input())
sum = a*5 + 40
tax = sum/10
total = sum + tax
print(round(total))
Thanks!!