Can anyone tell me what is my mistake in this code for "paint cost" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone tell me what is my mistake in this code for "paint cost"

I wrote this code and tried it in an IDE. It works properly there but here just telling Mr It's wrong! x= int(input('Please enter number of colors:')) cost= ((40)+5*x) payment = cost + 0.1 * cost print ('you have to pay:', payment )

10th Feb 2024, 1:27 PM
Mohammad Moeen
Mohammad Moeen - avatar
6 Answers
+ 3
one way to round up is using the ceil() function from the math module. from math import ceil print(ceil(3.14))
11th Feb 2024, 9:27 AM
Lisa
Lisa - avatar
+ 5
Do not print anything else than what the rask description telss you. NO "you have to pay:" NO "Please enter" Read the task description carefully. You are supposed to round UP
10th Feb 2024, 1:30 PM
Lisa
Lisa - avatar
+ 3
As mentioned above: You are supposed to ***round up***
11th Feb 2024, 9:11 AM
Lisa
Lisa - avatar
+ 1
Thanks for your help Dear Lisa; But I still didn't get it. I change my code to this: color = int(input()) cost= ((color * 5) +40) payment = (cost + 0.1 * cost) print (int(payment)) The program runs 3 times correctly in this app but shown 2 wrong tries!
11th Feb 2024, 9:07 AM
Mohammad Moeen
Mohammad Moeen - avatar
+ 1
First I try to round it up with round() function but it makes the whole of my code doesn't approve by the Application. Am I use wrong function for rounding up?
11th Feb 2024, 9:20 AM
Mohammad Moeen
Mohammad Moeen - avatar
+ 1
Thanks a lot, the problem is solved. 😊
11th Feb 2024, 9:46 AM
Mohammad Moeen
Mohammad Moeen - avatar