Skip to the content

Area of a rectangle

Problem

Write a function that takes the base and the height of a rectangle and returns its area (base times height).

Examples

  • 3, 4 → 12

  • 0, 5 → 0

  • 2.5, 2 → 5

Besides these, the challenge has hidden tests that are revealed when you submit your solution.

You start with this

Python

def rectangle_area(base, height):
    pass

JavaScript

function rectangleArea(base, height) {
}
Solve this challenge

It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.

More O(1) challenges

See all challenges →