I am writing a code about counting the number of cans needed to paint a wall. Od course number of cans should be round up. And there is my problem because math.ceil doesn’t work.
#Write your code below this line 👇
import math
def paint_calc(height, width, cover):
num_of_cans = math.ceil(height*width) / cover
print(f"You'll need {num_of_cans} cans of paint.")
#Write your code above this line 👆
# Define a function called paint_calc() so that the code below works.
# 🚨 Don't change the code below 👇
test_h = int(input("Height of wall: "))
test_w = int(input("Width of wall: "))
coverage = 5
paint_calc(height=test_h, width=test_w, cover=coverage)
Thanks.
>Solution :
You should ceil the final number, not the surface area:
math.ceil(height*width / cover)
In place of:
math.ceil(height*width) / cover