Skip to content

We will learn how to use the area_of_rectangle function here.

Prequisites: A willingness to learn about the fascinating field of rectangles.

The function is here:

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

To use this function, simply input the side length of each side into the function, and set it equal to a variable. For example:

area = area_of_rectangle(5,6)

Assessment: What is the value of your area variable? Hint: It should start with a 3 and end with a 0.

Recap: You just calculated the area of a rectangle with side lengths of 5 and 6. You should receive