Objective
Create a program with argparse that computes statistics of a list of numbers passed as arguments. The arguments of each test are passed to the program as if you typed them in the terminal (they appear in the test cases).
Instructions
- Positional argument
numberswithnargs="+"(one or more values) andtype=float(it converts them tofloat). - Option
--decimals(integer, default 2): decimals used to show the results. - Show
Count: k,Average: m,Minimum: xandMaximum: y(the last three with that number of decimals). - If no number is given,
argparseends with exit code 2.
Count: 3
Average: 9.00
Minimum: 4.00
Maximum: 15.00
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise