0
# Paint costs. Why are all the cases not solved with the Python code below. #My solution for Paint cost.
canvas_brushes=40.00 colors=int(input()) cost= colors * 5.00 tax=((canvas_brushes + cost) * 0.1) total=round(tax + canvas_brushes +cost) print (total)
4 Respuestas
+ 4
import math
canvas_brushes=40
colors=int(input())
cost= colors * 5
tax=((canvas_brushes + cost) * 0.1)
total=math.ceil(tax +40 +cost)
print (total)
+ 3
Use math.ceil()
+ 1
It is because that whenever there is decimal for the 'expected output', the output given by your programs does not have it. For example, 126.5 should be the output, but because you have rounded it, it returns 126. So that's why, all the cases are not solved.
0
canvas_brushes=40.00
colors=int(input())
cost= colors * 5.00
tax=((canvas_brushes + cost) * 0.1)
total=round(tax + canvas_brushes +cost,1)
if total%1==0:
total=round(total)
else:
pass
print(total)
Here is the solution