Area of a rectangle
- O(1) · Trivial
- Free
- Python
- JavaScript
- operations
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):
passJavaScript
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.