Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-025

Population Skewness

Problem

Return the population skewness: (1/n) * sum((x - mean)^3) / std^3, where std is the population standard deviation. Return 0.0 if data is empty or the standard deviation is zero.

Hint

Third central moment divided by the cube of the population standard deviation.

Test cases

case 1
in: [[1,2,3,4,5]]
expected: 0
case 2
in: [[1,2,3,4,10]]
expected: 1.1384199576606167
case 3
in: [[10,4,3,2,1]]
expected: 1.1384199576606167
case 4
in: [[5,5,5]]
expected: 0
case 5
in: [[1,2]]
expected: 0
Starter codePython
def skewness(data):
    # Your code here
    pass

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