Write a function calculate_mean(arr) that calculates the mean (average) of an array without using np.mean().
Example:
Input: arr = [2, 4, 6, 8, 10]
Output: 6.0
Constraints:
Test Cases
Test Case 1
Input:
[2, 4, 6, 8, 10]Expected:
6.0Test Case 2
Input:
[1, 2, 3]Expected:
2.0Test Case 3
Input:
[10, 20, 30, 40]Expected:
25.0+ 2 hidden test cases
Python 3
Loading editor...
Console Output
Click "Run" to test your code or "Submit" to submit your solution.