Created
October 25, 2015 21:02
-
-
Save popey456963/89bf0cff182259a48e6e to your computer and use it in GitHub Desktop.
Sorting MD-Arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
a = [] | |
for i in range(n): | |
item, distance = input().split() | |
distance = float(distance) | |
a.append([item, distance]) | |
sortdata = sorted(a, key=lambda x: x[1], reverse=True) | |
string = "" | |
for i in sortdata: | |
string+=str(i[0]) + " " | |
print(string[:-1]) |
developius
commented
Oct 25, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment