Compute all three central tendency measures — foundational statistics used everywhere in ML.
- **Mean**: average value
- **Median**: middle value when sorted
- **Mode**: most frequently occurring value
stats([1,2,2,3,4]) → {'mean': 2.4, 'median': 2, 'mode': 2}Round mean to **5 decimal places**.
Similar Problems
Test Cases (2 visible · 1 hidden)
Case 1: Basic case
Input: stats([1,2,2,3,4])
Expected: {'mean': 2.4, 'median': 2, 'mode': 2}
Case 2: Even length, all unique (first element as mode)
Input: stats([1,3,5,7])
Expected: {'mean': 4.0, 'median': 4.0, 'mode': 1}
⌘↵ Run · ⌘⇧↵ Submit