Q. Mean of means . given a nested tuple tup1 = ((1,2),(3,4.15,5.15),(7,8,12,15)). Write a program that display the mean of individual element of tuple tup1 and then displays the mean of these computed means.


You can understand by Watching video :-



Answer :-

a = ((1,2),(3,4.15,5.15),(7,8,12,15))
sum = 0
mean = 0
me= 0
for i in range (len(a)):
        sum = 0
        for j in range (len(a[i])):
                sum = sum+a [i][j]
        mean = sum /(j +1)
        print ("Mean element  ", i + 1 , ":",mean)
        me += mean
print ("Mean of means : ",me /3)

Output :-

Mean element 1 : 1.5
Mean element 2 : 4.1000000000000005
Mean element 3 : 10.5
Mean of means :  5.366666666666667

>>> 


2 Comments

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

Post a Comment

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

Previous Post Next Post