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.
if name == 'main':
li=[]
for _ in range(int(input())):
name = input()
score = float(input())
li.append([score,name])
# separating the name and the score
score=[x[0] for x in li]
name=[x[1] for x in li]
#for the sec low ele transfer to set
s=set(score)
ele=sorted(s)[1]
n=[]
count=-1
# checking if ele is in score then append this corresponding name for that use count to track
for i in score :
if i==ele:
count+=1
n.append(name[count])
n.sort()
for a in n:
print(a)
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 →
if name == 'main': li=[] for _ in range(int(input())): name = input() score = float(input()) li.append([score,name]) # separating the name and the score score=[x[0] for x in li] name=[x[1] for x in li] #for the sec low ele transfer to set s=set(score) ele=sorted(s)[1] n=[] count=-1 # checking if ele is in score then append this corresponding name for that use count to track for i in score : if i==ele: count+=1 n.append(name[count]) n.sort() for a in n: print(a)