Created
December 24, 2015 11:08
-
-
Save dboyliao/6de38f45301e417bfb55 to your computer and use it in GitHub Desktop.
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
l = [[1,2,3,4,5], [5,6,7,50], [10,20,30]] | |
i_max, (j_max, v_max) = max(enumerate([max(enumerate(ll), key = lambda t: t[1]) for ll in l]), key = lambda t: t[1][1]) | |
# >>> i_max = 1, j_max = 3, v_max = 50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then you can find the maximum by
l[i_max][j_max]
which will gives you50
in this example.