Q. Computing mean. Computing the mean of values stores in a tuple is relatively simple. The mean is the sum of the values divided by the number of values in the tuple.

mean = Sum of frequency /no.of frequency

Write a program that calculate and display the mean of a tuple with numeric element .


You can understand by Watching video :-



Answer :-

a = eval (input ("Enter the numeric tuple ="))
b = 0
for i in range (len(a)):
	b = b +a[i]
print('mean of tuple =',b/len(a))

Output :-

Enter the numeric tuple = (1,2,3,4,5,6,7,8,9)
Computing mean of tuple = 5.0

>>>

Enter the numeric tuple = (85,74,26,18,39,45)
Computing mean of tuple = 47.833333333333336

>>> 


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post