Created
February 14, 2014 18:01
-
-
Save jfo/9005834 to your computer and use it in GitHub Desktop.
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
# yuri's solution | |
def sort_last(tuples): | |
return sorted(tuples, key=lambda t: t[-1]) | |
# my dumb solution | |
def sort_lastt(tuples): | |
# +++your code here+++ | |
diction = {} | |
for thing in tuples: | |
diction[thing[-1]] = thing | |
newtuples = [] | |
i = 0 | |
while i <= 100: | |
if i in diction.keys(): | |
newtuples.append(diction[i]) | |
i = i + 1 | |
return newtuples |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment