Skip to content

Instantly share code, notes, and snippets.

@ashleighbasil
Created March 2, 2021 06:56
Show Gist options
  • Save ashleighbasil/079b4a5eeb073878e541a9d91a292107 to your computer and use it in GitHub Desktop.
Save ashleighbasil/079b4a5eeb073878e541a9d91a292107 to your computer and use it in GitHub Desktop.
cassidoo newsletter paint problem
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