Dataclasses, enumerations and types · 6 / 15 Exercise Easy

Statistics with types

Objective

Create a Python program with a function that has type annotations and returns a dictionary with several statistics.

Instructions

  • Define def statistics(numbers: list[int]) -> dict[str, int], which returns a dictionary with the keys "min", "max" and "sum".
  • Read a line with integers separated by spaces (at least one).
  • Show Minimum: X, Maximum: Y and Sum: S on three lines.
Input
4 8 15 16 23 42
Output
Minimum: 4
Maximum: 42
Sum: 108

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise