Question: Create a function called get_average that takes one argument: mylist and returns the average of the elements in mylist Function argument: This function takes one
Create a function called get_average that takes one argument: mylist and returns the average of the elements in mylist
Function argument: This function takes one argument named mylist.
What does it do?: This function filters out the non-number elements in mylist and then compute the average of the remaining number elements.
What it returns?: Returns the average of the numbers in mylist.
For instance,
example_list = ['Athens', 'Berlin', 1000, 'Istanbul', 2000, 'New York', 3000]
print(get_average(example_list))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
