Computer Science

Computing Mean. Computing the mean of values stored in a tuple is relatively simple. The mean is the sum of the values divided by the number of values in the tuple. That is, Write a program that calculates and displays the mean of a tuple with numeric elements.

Python

Python Tuples

4 Likes

Answer

tup = eval(input ("Enter the numeric tuple: "))

total = sum(tup)
tup_length = len(tup)
mean = total / tup_length

print("Mean of tuple:", mean)

Output

Enter the numeric tuple: 2,4,8,10
Mean of tuple: 6.0

Answered By

2 Likes


Related Questions