+ 2

What's wrong with my code?

You are getting ready to paint a piece of art. The canvas and brushes that you want to use will cost 40.00. Each color of paint that you buy is an additional 5.00. Determine how much money you will need based on the number of colors that you want to buy if tax at this store is 10%. Task Given the total number of colors of paint that you need, calculate and output the total cost of your project rounded up to the nearest whole number. Input Format An integer that represents the number of colors that you want to purchase for your project. Output Format A number that represents the cost of your purchase rounded up to the nearest whole number. Sample Input 10 Sample Output 99 My code: paint = int(input()) tax = ((paint * 5.00 ) + 40.00) * 10/100 cost = ((paint * 5.00 ) + 40.00) + tax print (int(cost))

22nd Aug 2021, 8:08 PM
Atena Molaie
8 odpowiedzi
+ 4
Atena Molaie as Lisa said, int() does not round up. The function to round up is round() Use that Edit: round() does simply that, it rounds up or down, whichever is correct
22nd Aug 2021, 8:57 PM
Brain & Bones
Brain & Bones - avatar
+ 7
The task description asks you to round ***up***. int() just cuts of the decimals but does not round up
22nd Aug 2021, 8:10 PM
Lisa
Lisa - avatar
+ 5
ceil() from math module can round up
22nd Aug 2021, 9:10 PM
Lisa
Lisa - avatar
+ 4
Hold up, Lisa s right, round() round up or down, whichever is correct. Im not quit sure why round() works for this challenge🤔
22nd Aug 2021, 9:40 PM
Brain & Bones
Brain & Bones - avatar
+ 2
Tysm😄this means a lot to me, ty both✨✨✨
22nd Aug 2021, 8:59 PM
Atena Molaie
+ 2
In the task part, it has said that we gotta round up the final number
23rd Aug 2021, 2:54 AM
Atena Molaie
+ 1
Then how can I round up a number... Guess haven't learned it yet
22nd Aug 2021, 8:47 PM
Atena Molaie
0
Brain & Bones it occurs when somehow the test cases are conveniently in the validity range of code, this indicates that the test cases aren't built with extreme/boundary cases in mind.
24th Aug 2021, 6:28 PM
scientist
scientist - avatar