We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Basic Data Types
- Nested Lists
- Discussions
Nested Lists
Nested Lists
Sort by
recency
|
4848 Discussions
|
Please Login in order to post a comment
if name == 'main': r=[] s=[] for _ in range(int(input())): name = input() score = float(input()) r.append([name,score]) s.append(score)
sls=sorted(set(s)) s4=sls[1] sln=[] for i,j in r: if j==s4: sln.append(i)
for i in sorted(sln): print(i)
if name == "main": records = []
Python 3 solution:
if name == 'main': list_of_students = [] for _ in range(int(input())): name = input() score = float(input()) list_of_students.append([name,score]) values = [x[1] for x in list_of_students] lowest_removed = [i for i in values if i != min(values)] secondlowestnames = [x[0] for x in list_of_students if x[1] == min(lowest_removed)] [print(x) for x in sorted(secondlowestnames)]
if name == 'main': d={} for _ in range(int(input())): name = input() score = float(input()) d.update({name:score}) scores = list(d.values()) minscore = float('inf') min2score = float('inf') for v in scores: if minscore>v: min2score = minscore minscore = v elif min2score>v and minscore