What is the mistake in this code for estimating paint costs | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the mistake in this code for estimating paint costs

brushes=40.00 rate=5.00 color= int(input()) cost= (color * rate )+ brushes tax= cost * 0.10 total = tax + cost total = round(total ) print(total )

2nd Sep 2020, 5:34 AM
Md. Ashraful Alam Emon
Md. Ashraful Alam Emon - avatar
2 Answers
+ 5
Use ceil() instead of round ( reason already told by Gordon ) https://code.sololearn.com/cddIJxrfmQ4d/?ref=app
2nd Sep 2020, 5:40 AM
Arsenic
Arsenic - avatar
+ 5
round() is banker's rounding, not maths rounding https://code.sololearn.com/c3oWdqMonrfA/?ref=app Banker's rounding means, rounding up and down alternately, so sum of all balances are not overlarge. Code Coach problems require maths rounding. You could do this by defining your own rounding function with if else statement.
2nd Sep 2020, 5:39 AM
Gordon
Gordon - avatar