Created
September 20, 2016 08:32
-
-
Save sz-ashik440/192bc22b18da0292832e65997a6787a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
x = [int(i) for i in input().strip().split(' ')] | |
#mean | |
print('{0:.1f}'.format(sum(x)/len(x))) | |
#mediun | |
sortX = sorted(x) | |
if len(x)%2!=0: | |
print('{0:.1f}'.format(sortX[len(x)/2])) | |
else: | |
print('{0:.1f}'.format((sortX[int(len(sortX)/2)] + sortX[int(len(sortX)/2)-1])/2)) | |
#Mode | |
dic = {} | |
for i in x: | |
if i not in dic: | |
dic[i]=1 | |
else: | |
dic[i]+=1 | |
modeValue = dic[max(dic, key=dic.get)] | |
mod = [key for key, value in dic.items() if value==modeValue] | |
print(sorted(mod)[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment