Problem 164082 · easy · Level 01 Prerequisites & Setup

Cans of Paint

functions · geometry · rounding

You are painting the four walls of a rectangular room (not the floor or ceiling). The room is length by width metres and height metres tall. One can of paint covers coverage square metres. Write paint_cans(length, width, height, coverage) that returns the number of whole cans you must buy.

Examples

Input:  length = 5, width = 4, height = 3, coverage = 10
Output: 6
Explanation: walls total 2 * (5 + 4) * 3 = 54 m²; 54 / 10 = 5.4, so 6 cans.

Input:  length = 5, width = 4, height = 3, coverage = 54
Output: 1

Constraints

  • All values are positive ints or floats, at most 1000
  • Return an integer

Goals

  • Compute the area of four walls
  • Round up to a whole number of cans
Starting Python…