EasyPro challengePython
Standard Library — Math & Statistics
PythonMathStandard Library
Implement solve(data, mode) using Python's math and statistics modules:
"circle_area"→datais a radius; return the area of the circle (π × r²)."hypotenuse"→datais[a, b]; return the hypotenuse of a right triangle (√(a²+b²))."mean"→ return the arithmetic mean of the listdata."median"→ return the median of the listdata."variance"→ return the variance of the listdata.
Examples
solve(5, "circle_area")→78.539...solve([3, 4], "hypotenuse")→5.0solve([1, 2, 3, 4, 5], "mean")→3.0
Sample tests
Test #1Circle area r=5
Input: [5,"circle_area"]
Output: 78.53981633974483
Test #2Classic 3-4-5 triangle
Input: [[3,4],"hypotenuse"]
Output: 5
Test #3Mean of 1-5
Input: [[1,2,3,4,5],"mean"]
Output: 3
Test #4Median odd count
Input: [[1,3,5],"median"]
Output: 3