Q. Consider the amount of donations received by a charitable organization given as under:


donations = [100, 60, 70, 900, 100, 200, 500, 500, 503, 600, 1000, 1200]


Now write a Python program to calculate the average amount obtained and median of the above data.


Answer :-

import statistics as s
donations = [100, 60, 70, 900, 100, 200, 500, 500, 503, 600, 1000, 1200]
print ("List :- ", donations)
print ("Average amount :- ", s.mean(donations))
print ("Median of the data :- ", s.median(donations))

Output :-

List :-  [100, 60, 70, 900, 100, 200, 500, 500, 503, 600, 1000, 1200]
Average amount :-  477.75
Median of the data :-  500.0

>>>

Post a Comment

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

Previous Post Next Post