-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathNestedList.py
More file actions
37 lines (31 loc) · 825 Bytes
/
NestedList.py
File metadata and controls
37 lines (31 loc) · 825 Bytes
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
# if __name__ == '__main__':
# l = []
# for _ in range(int(input())):
# name = input()
# score = float(input())
# # l.append(name)
# # m.append(score)
# m = []
# m.append(score)
# m.append(name)
# l.append(m)
#
# t = sorted(l, key=lambda i: (i[1], i[0]), reverse=True)[-2][0]
# # print(t)
# q = []
# for i in l:
# if i[0] == t:
# q.append(i[1])
# print('\n'.join(sorted(q)))
#
# # t=sorted(m)[-3]
# # for i in l:
#
#
#
# Optimized Code
if __name__ == '__main__':
n=int(input())
marksheet=[[input(),float(input())] for _ in range(n)]
second_highest = sorted(list(set([marks for name, marks in marksheet])))[1]
print('\n'.join([a for a,b in sorted(marksheet) if b == second_highest]))