-
Notifications
You must be signed in to change notification settings - Fork 0
/
stat_3.py
61 lines (41 loc) · 1.07 KB
/
stat_3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
def quantiles(arr):
res=[]
''' ******* Quantiles number 1 ****** '''
quant1=(arr[0]+arr[1])/2
res.append(quant1)
''' ***** Quantiles number 2 ******* '''
if len(arr)%2==1:
res.append(arr[len(arr)//2])
elif len(arr)%2==0:
res.append((arr[len(arr)-1]+ arr[len(arr)]))
''' ****** Quantiles number 3 ******* '''
quant3 =(arr[-1]+arr[-2])/2
res.append(quant3)
print(res)
n=int(input())
arr_1=list(map(int, input().split()))
arr_1.sort()
quantiles(arr_1)
'''#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'quartiles' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts INTEGER_ARRAY arr as parameter.
#
def quartiles(arr):
# Write your code here
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input().strip())
data = list(map(int, input().rstrip().split()))
res = quartiles(data)
fptr.write('\n'.join(map(str, res)))
fptr.write('\n')
fptr.close()
'''