0

Help me to solve this. I have almost done. But 2 out of 5 test cases are failing, which are hidden. I don't know y.☹️

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 Code: ncol= int(input()) cancost = 40.00 colcost = ncol * 5.00 tax = 0.1 * (cancost + colcost) totalcost = (cancost + colcost + tax ) print(int(totalcost))

18th Oct 2020, 9:17 AM
CHAKKA VENKATA NAGA SAI JYOTHIRMAI
CHAKKA VENKATA NAGA SAI JYOTHIRMAI - avatar
5 Réponses
18th Oct 2020, 9:27 AM
Muhammad Galhoum
Muhammad Galhoum - avatar
+ 2
Tq. I didn't use the ceil method may be that's y the 2 cases are failed.... Now it's success..
18th Oct 2020, 9:37 AM
CHAKKA VENKATA NAGA SAI JYOTHIRMAI
CHAKKA VENKATA NAGA SAI JYOTHIRMAI - avatar
0
Tq
18th Oct 2020, 9:30 AM
CHAKKA VENKATA NAGA SAI JYOTHIRMAI
CHAKKA VENKATA NAGA SAI JYOTHIRMAI - avatar
0
Maybe because you're using float (5.00)... The input and output are int. Output format: rounded up to the nearest whole number. So you need test if recimal are highter or less than 0.5 (not python, but the logical is:) floatTotal; int intTotal; decimal = floatTotal - intTotal; if(decimal > 0.5) intTotal + 1; else intTotal; check decimal and rounde to the nearest.
18th Oct 2020, 9:30 AM
Marcelo Anjos
Marcelo Anjos - avatar
0
You can first run your code here on the Playground and test with a few different data‘s inputs. Additional prepare some information prints between. Then you can see what your code really do in different situations.
18th Oct 2020, 9:31 AM
JaScript
JaScript - avatar