In this problem, you should write one function named average_numbers
.
This function should have one parameter variable.
You can assume that the value passed to the parameter will be an integer, representing the number of numbers to average.
The function will repeatedly ask the user for that many numbers, and then calculate and print the average.
Below are two examples of this function being called.
The first would be an example of the function being called with 2
as the argument, and the second with 5
as the argument.
Number:
5
Number:
10
Average = 7.5
Number:
20
Number:
70
Number:
85
Number:
10
Number:
5
Average = 38.0
You may call the functions in your code in order to test. However, you should remove all calls to the function before you submit to gradescope. The gradescope tests will call the functions to test them.
Name the program prep12.py
.
Make sure that gradescope gives you the points for passing the test case.