CBSE Class 11 Informatics Practices
Question 62 of 80
Lists in Python — Question 25
Back to all questions 25
Question Write a program to calculate mean of a given list of numbers.
numbers = eval(input("Enter a list: "))
if len(numbers) == 0:
print("List is empty, cannot calculate mean.")
else:
total = sum(numbers)
n = len(numbers)
mean = total / n
print("Mean of the numbers:", mean)Enter a list: [10, 30, 25, 34, 45, 98]
Mean of the numbers: 40.333333333333336