Skip to content
DeepForgeby svx
All problems
HardStatisticsst-331

Bowley Skewness Coefficient

Problem

Bowley skewness uses quartiles: (Q3 + Q1 - 2 Q2) / (Q3 - Q1), which is bounded in [-1, 1] and robust to outliers.

Given Q1, the median Q2, and Q3, return the coefficient. Assume Q3 > Q1.

Hint

A positive value means the upper half stretches further from the median.

Test cases

case 1
in: [1,2,6]
expected: 0.6
case 2
in: [1,3,5]
expected: 0
case 3
in: [10,10,20]
expected: 1
Starter codePython
def bowley_skewness_coefficient(q1, q2, q3):
    # Your code here
    pass

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