Circle Math with the math Module

Easy ⏱ 8 min 78% acceptance ★★★★★ 4.8
Write circle_stats(radius) returning a tuple (area, circumference) using math.pi, both rounded to 2 decimals. Import the module — do not hardcode 3.14159.

Examples

Example 1
Input
circle_stats(2)
Output
(12.57, 12.57)
Explanation

π×4 area and 2π×2 circumference both round to 12.57.

Constraints

  • Use math.pi.
  • Round both to 2 decimal places.

Topics

Modules & Packagesmath

Companies

TCSWiproCognizant

Hints

Hint 1

import math at the top.

Hint 2

Area is pi r²; circumference is 2 pi r.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.