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

Problem solving

---This is 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. 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 ---This is my solution--- coloures = float(input()) coc = coloures*5.00 cob = 40.00 tax = (coc + cob) * (10/100) total_cost = coc + cob + tax hole_num = total_cost //10 print (int(total_cost)) ---Is this solution incorrect?--- Please anyone help me

11th Apr 2021, 7:03 PM
Hammad Karim
Hammad Karim - avatar
5 Answers
+ 3
print(round(total_cost))
12th Apr 2021, 2:57 AM
Simba
Simba - avatar
+ 2
Thank to all, specially for Simba
12th Apr 2021, 6:03 PM
Hammad Karim
Hammad Karim - avatar
+ 1
Hammad Karim Also you need to address the round up aspect of the challenge.
11th Apr 2021, 9:13 PM
Rik Wittkopp
Rik Wittkopp - avatar
0
Is it math or Python you want to have help with? What in the code is the problem? Can you print out it step by step and follow if it match your calculations done with a calculator? You must specify exactly what you want to have help with.
11th Apr 2021, 7:16 PM
Per Bratthammar
Per Bratthammar - avatar
0
Hammad Karim The challenge specifies an integer input, you have a float input which may be causing some problem
11th Apr 2021, 9:11 PM
Rik Wittkopp
Rik Wittkopp - avatar