Created
March 2, 2021 06:56
-
-
Save ashleighbasil/079b4a5eeb073878e541a9d91a292107 to your computer and use it in GitHub Desktop.
cassidoo newsletter paint problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import ceil | |
def surface_area(l, w, h): | |
return 2 * (w*l+h*l+h*w) | |
# only four walls and roof, we don't paint floor | |
def room_surface(l, w, h): | |
return surface_area(l, w, h) - (2 * l * w) | |
def number_of_cans(room, can_coverage): | |
return ceil(room_surface( | |
room['length'], | |
room['width'], | |
room['height'] | |
) / can_coverage) | |
room = { "length": 12, "width": 10, "height": 9 } | |
can_coverage = 200 | |
print(number_of_cans(room, can_coverage)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment