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.
2) name = input() # Harry
score = float(input()) #37.21
At this point we get the name and score. This will be done 5 times.
3) k.append([name,score])
In list K we add the name and score to the list
4) mark = (sorted(list(set([m for n,m in k]))))
#with loop taken n= name and m = score
set : delet duplicate elements
list : creat list of score
sorted : Regular elements of mark
5) print("\n".join([a for a,b in sorted(k) if b == mark[1]]))
# b == mark[1]] = second element of mark
In list K we add the name and score to the list
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 →
hi 1) for _ in range(int(input())):
input() = 5
This loop will be repeated 5 times
2) name = input() # Harry score = float(input()) #37.21
At this point we get the name and score. This will be done 5 times.
3) k.append([name,score])
In list K we add the name and score to the list
4) mark = (sorted(list(set([m for n,m in k])))) #with loop taken n= name and m = score set : delet duplicate elements list : creat list of score sorted : Regular elements of mark
In list K we add the name and score to the list