0

What's wrong in my code?3output were correct but 2 were hidden and wrong.

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. My Code- canvas=40.00 color_paint=5.00 paints=int(input()) cost=int(canvas)+ (paints)*int(color_paint ) Total_cost=int(int(cost)+int(cost)*10/100) print(Total_cost )

11th May 2021, 9:41 AM
Taslima Akter
Taslima Akter - avatar
3 Answers
+ 2
colors=int(input()) total=40.00+(colors*5.00) print(round(total+(total*0.1))) No need of converting to 'int'. The suggestion I can give you by seeing your code is, whenever you can able to do direct operations, do that operation without storing those values in some other variables...
11th May 2021, 9:54 AM
sarada lakshmi
sarada lakshmi - avatar
0
Taslima Akter Do cast with int in final amount. If you will do before you will not get actual result. So just do this: paints = int(input()) canvas = 40.0 color_paint = 5.00 total_cost = paints * color_paint + canvas total_cost = total_cost + total_cost * 10 / 100 total_cost = total_cost + 0.5 print(int(total_cost));
11th May 2021, 10:13 AM
A͢J
A͢J - avatar
11th May 2021, 3:33 PM
Taslima Akter
Taslima Akter - avatar