Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-036

Outlier Count by IQR Fence

Problem

Return the number of values outside the 1.5*IQR fences, using the exclusive-method quartiles: below Q1 - 1.5*IQR or above Q3 + 1.5*IQR. Return 0 for empty input.

Hint

Compute the quartiles first, then count values beyond the fences.

Test cases

case 1
in: [[1,2,3,4,5]]
expected: 0
case 2
in: [[1,2,3,4,100]]
expected: 1
case 3
in: [[-50,1,2,3,4]]
expected: 1
case 4
in: [[7,7,7]]
expected: 0
case 5
in: [[1,2,3,4,5,6,7,8,100]]
expected: 1
Starter codePython
def outliers_iqr(data):
    # Your code here
    pass

5 test cases · run your code against them in the editor