Last active
August 29, 2015 14:01
-
-
Save skatenerd/1e4fef1d42a3b7e3c4dc to your computer and use it in GitHub Desktop.
item getter
This file contains hidden or 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
input = [(1,2), (3,4)] | |
expected_output = [2,4] | |
def first_way(input): | |
def get_second_thing(tuple): | |
return tuple[1] | |
return map(get_second_thing, input) | |
def second_way(input): | |
return map(operator.itemgetter(1), input) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment