Rectangle Perimeter

Rectangle Perimeter

This function should take two positive numbers (length and width) as inputs and return the perimeter of a rectangle.

example

Input: Two integers (int).

Output: Integer (int).

Examples:

assert rectangle_perimeter(2, 4) == 12
assert rectangle_perimeter(3, 5) == 16
assert rectangle_perimeter(10, 20) == 60
assert rectangle_perimeter(7, 2) == 18

How it’s used:

  • in architectural and engineering applications for calculating the perimeter of buildings or rooms;
  • in computer graphics to calculate the perimeter of a rectangle on a screen.

Preconditions:

  • length, width ∈ R;
  • length, width > 0.