Rectangle Area

Rectangle Area

Write a function that computes the area of a rectangle.

rectangle_area(width, height)

Return width * height.

Examples

rectangle_area(4, 5)    // → 20
rectangle_area(10, 10)  // → 100
rectangle_area(1, 1)    // → 1

Walkthrough

Thinking it through

There's no trick here — the area of a rectangle is its width times its height, full stop:

def rectangle_area(width, height):
    return width * height

The only thing worth internalizing at this stage is the shape every function in this course will follow: take some inputs as parameters, compute a value, return it (not print it — see the previous lesson). You'll build on this exact pattern for the rest of the course, just with more interesting computations inside.

main.py
Console
Press Run to execute your code, or Submit to test and complete this problem.