# Use the Design Recipe to write a function called running_average that repeatedly asks the user to input integers at the keyboard until they type the word done. Return the average of the values they entered. You may assume the user will only enter integers or "done". Include a docstring!

Question
65 views

Use the Design Recipe to write a function called running_average that repeatedly asks the user to input integers at the keyboard until they type the word done. Return the average of the values they entered. You may assume the user will only enter integers or "done". Include a docstring!

check_circle

star
star
star
star
star
1 Rating
Step 1

DESIGN RECIPE:

1. Based on the given problem use meaningful variable and function name. And perform the given problem's solution. Write a method called running_average and return float datatype after calculation of all integer type entries and terminates the method when the user enters "done".

"""running_average_module module's docstring"""

1. Write the function's header with void parameter, and returns average.

def running_average() :

1. Declare all required variables and create a while loop that will get the user's input and checks whether that input is of integer type of not. If it is of integer type then continue the loop by adding value in variable num_averger and if it is false then terminate the program with calculating entered values data and return that data to the main function.

"""running_average function's docstring"""

num_avg = 0

count = 0

while(True) :

num = input("please enter here: ")

If(num[0] >= '0' and num[0] <= '9') :

...

### Want to see the full answer?

See Solution

#### Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in