Write Python program to find Mathematical Median of Cumulative Records


Topic: Write Python program to find Mathematical Median of Cumulative Records

Solution

test_list = [(1, 4, 5), (7, 8), (2, 4, 10)] 
print("The original list : " + str(test_list)) 
res = [] 
for sub in test_list : 
    for ele in sub : 
        res.append(ele) 
res.sort() 
mid = len(res) // 2
res = (res[mid] + res[~mid]) / 2
print("Median of Records is : " + str(res)) 



List all Python Programs