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.
n=[]
s=[]
l=[]
a=int(input())
for i in range(a):
name = input()
score = float(input())
n.append([name,score])
s.append(score)
o=min(s)
while o in s:
i=s.index(o)
n.pop(i)
s.remove(o)
x=min(s)
while x in s:
i=s.index(x)
l.append(n[i])
n.remove(n[i])
s.remove(s[i])
l.sort()
for i in l:
print(i[0])
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Nested Lists
You are viewing a single comment's thread. Return to all comments →
n=[] s=[] l=[] a=int(input()) for i in range(a): name = input() score = float(input()) n.append([name,score]) s.append(score) o=min(s) while o in s: i=s.index(o) n.pop(i) s.remove(o) x=min(s) while x in s: i=s.index(x) l.append(n[i]) n.remove(n[i]) s.remove(s[i]) l.sort() for i in l: print(i[0])