본문 바로가기
HackerRank Algorithm

[HackerRank] 04. Nested List

by KIha_Jung 2020. 3. 9.

student = []

if __name__ == '__main__':
    for _ in range(int(input())):
        name = input()
        score = float(input())
        student.append((name, score))
# set을 통해 중복 원소 제거
second_lowest = sorted(set([score for name, score in student]))[1]
# join method is a string method which returns a string concatenated with the elements of an iterable
print('\n'.join(sorted([name for name, score in student if score == second_lowest])))

'HackerRank Algorithm' 카테고리의 다른 글

[HackerRank] 06. Min and Max  (0) 2020.03.09
[HackerRank] 05. Mini-Max Sum  (0) 2020.03.09
[HackerRank] 03. Sock Merchant  (0) 2020.03.09
[HackerRank] 02. Sum and Prod  (0) 2020.03.09
[HackerRank] 01. Time Conversion  (0) 2020.03.09

댓글