Skip to content

Commit ae456be

Browse files
Create AthleteSort.py
Athlete Sort was missing. Solution added.
1 parent 2a3b561 commit ae456be

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

BuiltIns/AthleteSort.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
'''
2+
Title : Athlete Sort
3+
Subdomain : Built-Ins
4+
Domain : Python
5+
Author : Atharva Shah
6+
Created : 3 April 2021
7+
Problem : https://www.hackerrank.com/challenges/python-sort-sort/problem
8+
'''
9+
10+
import sys
11+
12+
if __name__ == "__main__":
13+
n, m = input().strip().split(' ')
14+
n, m = [int(n), int(m)]
15+
arr = []
16+
for arr_i in range(n):
17+
arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')]
18+
arr.append(arr_t)
19+
k = int(input().strip())
20+
21+
sorted_arr = sorted(arr, key = lambda x : x[k])
22+
for row in sorted_arr:
23+
print(' '.join(str(y) for y in row))

0 commit comments

Comments
 (0)