Paint color: Can’t pass test 3 and 4, what’s wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Paint color: Can’t pass test 3 and 4, what’s wrong?

import math as m paint = input() art = 40 pcost = 5 tax = 0.1 tcost = (int(paint)*pcost)+art tcost += tcost * tax print(m.floor(tcost))

1st Jun 2022, 2:58 PM
Evgeny Sergeev
Evgeny Sergeev - avatar
2 Answers
+ 3
Evgeny Sergeev use round instead of floor print (round(tcost))
1st Jun 2022, 3:02 PM
A͢J
A͢J - avatar
+ 5
since the task description says: Output Format A number that represents the cost of your purchase rounded up to the nearest whole number ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ so round() would not give the correct result. we have to use ceil() from math module instead.
1st Jun 2022, 5:39 PM
Lothar
Lothar - avatar