Algorithm/코딩테스트 [goorm Level1] 출석부 - 문제 https://level.goorm.io/exam/159667/%EC%B6%9C%EC%84%9D%EB%B6%80/quiz/1 풀이방법 (이름,키) 쌍의 튜플을 attendance리스트에 넣어서 관리 attendance리스트를, lambda로 sort하는 문법을 사용 문법 sorted_list = sorted(my_list, key=lambda x: (x[0], x[1])) key값에 비교 기준을 두 개를 넣으면, x[0]이 동일할 경우 x[1]을 비교한다 코드 n,k = map(int,input().split()) attendance = [] for _ in range(n): name,height = input().split() attendance.append((name,height)) attendance = sorted(attendance, key=lambda x: (x[0], x[1])) x,y = attendance[k-1] print(x,y) 공유하기 URL 복사카카오톡 공유페이스북 공유엑스 공유 게시글 관리 구독하기숨쉬는 일상 Contents 당신이 좋아할만한 콘텐츠 [goorm Level2] 성적표 2024.06.14 [goorm Level 2] 폭탄 구현하기 (2) 2024.06.13 [프로그래머스 LV1] 공원 산책 2024.06.10 [프로그래머스 LV.1] 신규 아이디 추천 2024.06.09 댓글 0 + 이전 댓글 더보기