Answer:
The following code is in python.
import statistics as st #importing statistics which include mean function.
def average(lst): #function average.
return st.mean(lst)#returning mean.
lst=a = list(map(int,input("\\Enter the list : ").strip().split()))#taking input of the list..
print("The average is "+str(average(lst)))#printing the average.
Output:-
Enter the list :
1 2 3 4 5 6
The average is 3.5
Step-by-step explanation:
I have used the statistics library which includes the mean function that calculates the mean or average of the list.In the function average having lst as an argument returns the mean of the list lst.
Then taking lst input from the user and printing it's average.