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)

24th Mar 2020, 6:56 AM
Amah Emeka
Amah Emeka - avatar
4 Answers
+ 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)
24th Mar 2020, 7:09 AM
Cmurio
Cmurio - avatar
+ 3
Use math.ceil()
24th Mar 2020, 7:10 AM
Cmurio
Cmurio - avatar
+ 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.
24th Mar 2020, 7:03 AM
Taranjeet
Taranjeet - avatar
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
24th Mar 2020, 7:10 AM
Taranjeet
Taranjeet - avatar