HackerRank Python - Athlete Sort
You are given a spreadsheet that contains a list of N athletes and their details (such as age, height, weight and so on). You are required to sort the data based on the Kth attribute and print the final resulting table. Follow the example given below for better understanding.
- #!/bin/python3
-
- import math
- import os
- import random
- import re
- import sys
-
- N, M = map(int, input().split())
- rows = [input() for _ in range(N)]
- K = int(input())
-
- for row in sorted(rows, key=lambda row: int(row.split()[K])):
- print(row)