Skip to the content

The area of the plate

Problem

A round plate measures diameter centimeters from edge to edge, straight through the center. Write a function that returns how much surface it covers. The area of a circle is pi times the radius squared, and careful: the formula asks for the radius, not the diameter.

Use 3.1416 for pi and return the result rounded to two decimals. A plate with a diameter of 1 measures 0.79, and one of 10 measures 78.54.

Examples

  • 10 → 78.54

  • An odd diameter

    7 → 38.48

  • The smallest plate

    1 → 0.79

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

You start with this

Python

def plate_area(diameter):
    pass

JavaScript

function plateArea(diameter) {
}
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 →