백준 10814 파이썬 (1) 썸네일형 리스트형 [백준] 나이순 정렬 10814 Python 1 2 3 4 5 6 7 8 9 10 n = int(input()) lists = [] for i in range(n): lists.append(list(map(str, input().strip().split()))) lists[i][0] = int(lists[i][0]) lists.sort(key= lambda x:x[0]) # 0 인덱스를 오름차순으로, 만약 내림차순으로 하고 싶다면 -를 붙인다. / 그리고 0 인덱스가 동일하고 1을 내림으로 하고 싶다면 x:(x[0],-x[1]) for i in lists: print(i[0], i[1]) 이전 1 다음