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

Paint costs

I’m using python to solve a 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%. 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. Here is my code for the exercise: x=int(input()) y=(x*5+40)*1.1 print(y) How do I rounded the output to the nearest whole number?

1st Jan 2021, 7:10 AM
Haha36
4 Answers
+ 6
#Try this print(round(y))
1st Jan 2021, 8:02 AM
Simba
Simba - avatar
+ 5
Your attempt
1st Jan 2021, 7:17 AM
VṢtēphen
VṢtēphen - avatar
+ 2
Haha36 The trick within this challenge is the wording "round up", which is different to rounding. A Python method: import math print(math.ceil(a number or equation here) example: print(math.ceil(65.15) #66 Another way of presenting the same concept is: from math import ceil as mc print(mc(64.12))
1st Jan 2021, 11:13 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Thanks, everyone
2nd Jan 2021, 5:49 AM
Haha36