+ 2

(solved) math.ceil weird result at Paint cost Code coach

https://code.sololearn.com/cRkJa7focOvS/?ref=app

28th Jan 2020, 1:53 PM
GĂĄbor Zombory
GĂĄbor Zombory - avatar
14 RĂ©ponses
+ 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))
28th Jan 2020, 5:56 PM
GĂĄbor Zombory
GĂĄbor Zombory - avatar
+ 2
change math.ceil to round
28th Jan 2020, 2:03 PM
BroFar
BroFar - avatar
+ 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
28th Jan 2020, 2:03 PM
GĂĄbor Zombory
GĂĄbor Zombory - avatar
+ 1
not sure why, 50*1.1 is 55.0000001 which messing up with the result
28th Jan 2020, 2:10 PM
Taste
Taste - avatar
+ 1
the result is suppose to be rounded to the nearest dollar amount
28th Jan 2020, 2:12 PM
BroFar
BroFar - avatar
+ 1
Here you'll find the explanations - I had the very same problem. https://www.sololearn.com/discuss/2117961/?ref=app
28th Jan 2020, 2:28 PM
HonFu
HonFu - avatar
30th Jan 2020, 2:13 AM
tusar behera
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.
28th Jan 2020, 2:17 PM
Taste
Taste - avatar
0
Taste: Exactly. Thats what i dont really understand
28th Jan 2020, 2:24 PM
GĂĄbor Zombory
GĂĄbor Zombory - avatar
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))
28th Jan 2020, 5:03 PM
Thống Nguyễn
Thống Nguyễn - avatar
0
Same here only 3 out 5 is correctđŸ€”
28th Jan 2020, 5:50 PM
Samarendra Singh
Samarendra Singh - avatar
0
3 and 4 test shows error😔
28th Jan 2020, 5:51 PM
Samarendra Singh
Samarendra Singh - avatar
28th Jan 2020, 6:24 PM
Samarendra Singh
Samarendra Singh - avatar
0
https://code.sololearn.com/ch9Ub4XXxjE0/?ref=app Here was my paint challenge and I used ceil too
28th Jan 2020, 11:05 PM
SouthRD
SouthRD - avatar