Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-329

Trimmed Count Each Side

Problem

A symmetric trimmed mean discards floor(proportion * n) observations from each tail.

Given the sample size n and the trim proportion in [0, 0.5), return the number of observations removed from each side.

Hint

Round down to keep the same count on both sides.

Test cases

case 1
in: [10,0.1]
expected: 1
case 2
in: [20,0.25]
expected: 5
case 3
in: [7,0.2]
expected: 1
Starter codePython
def trimmed_count_each_side(n, proportion):
    # Your code here
    pass

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