Skip to content

Providing background and context to gain deeper understanding of rectangles

Introduction: We wil be learning about rectangles in this section.

Background: Rectangles are shapes with four sides that are perpindicular to each other, thus forming 90 degree angles.

Definition: From Oxford Languages dictionary, a rectangle is a "a plane figure with four straight sides and four right angles, especially one with unequal adjacent sides, in contrast to a square."

Details: The above definition is somewhat confusing because as they say, a square is a rectangle, but a rectangle is not a necessarily square.

We can find the area of a rectangle by multiplying the length of one side, by the length of its adjacent side.

The perimeter is found by adding the length of all 4 sides, or since 2 sides are identical, 2 times one side plus 2 times the adjacent side.

Summary: Rectangles are cool.

Area of Rectangle

Source code in rectangles.py
2
3
4
def area_of_rectangle(width, height):
    area = width * height
    return area

Perimeter of Rectangle

Source code in rectangles.py
7
8
9
def perimeter_of_rectangle(width, height):
    perimeter = 2*(width + height)
    return perimeter