 # Question & Answer: Create a function that will take a list of floats as an argument. The function will then f…..

Create a function that will take a list of floats as an argument. The function will then find the average of that list and return it as a float. Test your function by calling it and printing the average.

Python Code 3.
Need help

# python program to caculate the average of numbers in the given list

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: Create a function that will take a list of floats as an argument. The function will then f…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

# average function definition
def average(list):
avg=0

#both sum() and len() are pre-defined functions in python

# sum() function is used to calculate the total of numbers in the given list
# len() function is used to calcualte the count of numbers in the given list

avg=sum(list)/len(list)
return avg

print ‘Enter the list of numbers’;
# input() function is used to read the list of values

# reading list of values into y

y=input()

# passing list of y values to the function average
result=average(y)
print ‘average of gvien list of numbers is’,result

OUTPUT: 