Grade Summary with the statistics Module

Easy ⏱ 8 min 73% acceptance ★★★★★ 4.9
Write grade_summary(scores) returning a dict with mean, median, and mode of a non-empty list of integers, using the statistics module (round the mean to 2 decimals). No hand-rolled math.

Examples

Example 1
Input
grade_summary([80, 90, 90, 70])
Output
{'mean': 82.5, 'median': 85.0, 'mode': 90}
Explanation

Library functions compute all three.

Constraints

  • Use statistics.mean/median/mode.
  • Round only the mean.

Topics

Modules & Packagesstatistics

Companies

DeloitteKPMGEY

Hints

Hint 1

import statistics.

Hint 2

median of an even-length list averages the middle pair.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.