init: company-haness 설계

This commit is contained in:
DongHyeonka
2026-07-23 17:49:00 +09:00
parent 57d1bab894
commit f668d6a158
962 changed files with 98989 additions and 1 deletions
+16
View File
@@ -0,0 +1,16 @@
"""Running statistics — contains a bug in `median` for even-length inputs.
The bug: for an even number of elements, `median` returns the lower-middle element
instead of the average of the two middle elements. `mean` is correct.
"""
def mean(xs):
return sum(xs) / len(xs)
def median(xs):
s = sorted(xs)
n = len(s)
mid = n // 2
return s[mid] # BUG: even-length should average s[mid-1] and s[mid]