All problems
Mean Absolute Deviation from Median
Problem
The median absolute deviation about the median is mean_i |x_i - median(x)|, which is less sensitive to outliers than the mean absolute deviation about the mean.
Given the values, return this quantity.
Hint
Find the median first, then average absolute deviations from it.
Test cases
case 1
in: [[1,2,3,4]]
expected: 1
case 2
in: [[1,1,1]]
expected: 0
case 3
in: [[0,10]]
expected: 5
Starter codePython
def mean_absolute_deviation_from_median(values):
# Your code here
pass3 test cases · run your code against them in the editor