41 - Write a program in Python to input a list of numbers and find the mean, mode and median.
import statistics as s
L=[]
n=int(input("Enter
the size of the list: "))
for i in range(0,n):
a=int(input("Enter element of List:
"))
L.append(a)
print("List is:
", L)
print("Mean of the
given data: ",s.mean(L))
print("Mode of the
given data: ",s.mode(L))
print("Median of the
given data: ",s.median(L))
Output:
Enter the size of the list: 5
Enter element of List: 8
Enter element of List: 9
Enter element of List: 3
Enter element of List: 9
Enter element of List: 7
List is: [8, 9, 3, 9,
7]
Mean of the given data:
7.2
Mode of the given data:
9
Median of the given data:
8
Enter the size of the list: 6
Enter element of List: 2
Enter element of List: 8
Enter element of List: 9
Enter element of List: 4
Enter element of List: 7
Enter element of List: 9
List is: [2, 8, 9, 4,
7, 9]
Mean of the given data:
6.5
Mode of the given data:
9
Median of the given data:
7.5