+ 2
(solved) math.ceil weird result at Paint cost Code coach
14 odpowiedzi
+ 3
This one worked for me
amount = int(input(""))
fix = 40
paint = 5
x = (fix+(paint*amount))*1.1
# import math.ceil didnt worked
print(round(x))
+ 2
change math.ceil to round
+ 1
I've found it, had to change math.ceil to round(), but i dont understand why. Maybe i'm wrong but its illogical for me
+ 1
not sure why, 50*1.1 is 55.0000001 which messing up with the result
+ 1
the result is suppose to be rounded to the nearest dollar amount
+ 1
Here you'll find the explanations - I had the very same problem.
https://www.sololearn.com/discuss/2117961/?ref=app
+ 1
This code worked for me
https://www.sololearn.com/coach/22?ref=app
0
the task itself said "rounded up to nearest whole number". i also tried to solve it with round before, and it keep failing in case 3.
0
Taste:
Exactly. Thats what i dont really understand
0
This is my try using math.ceil, but it pass. And i don't really understand too!
usinput = int(input())
import math
nest = (usinput*5)+40
tax = nest/10
print(math.ceil(nest+tax))
0
Same here only 3 out 5 is correct🤔
0
3 and 4 test shows error😔
0
Wow i make it😊😊
https://code.sololearn.com/ce221DIih46L/?ref=app
0
https://code.sololearn.com/ch9Ub4XXxjE0/?ref=app
Here was my paint challenge and I used ceil too