Paint cost code coach | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Paint cost code coach

Why wont my code work if i have 2 colors but will work for other number of colours? paint=int(input()) import math cost = (paint*5) + 40 print(math.ceil(cost*1.1)) Here is the code coach problem: 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%. 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

8th Jun 2020, 8:10 AM
1 Answer
+ 1
Try this one , this looks easy and also effective.... import math canvas_brushes = 40.00 color_paint = 5.00 tax = 10 number_colors = int(input()) # 10 total_cost = (color_paint * number_colors) + canvas_brushes tax_cost = total_cost / 100 * tax result = math.ceil(total_cost + tax_cost) print(result)
8th Jun 2020, 8:15 AM
👑FabVab👑 - avatar