Created
December 17, 2016 08:29
-
-
Save yasufumy/7b17474cf06e94710595442d0e17de59 to your computer and use it in GitHub Desktop.
argmax function by pure python
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
def argmax1(array): | |
return array.index(max(array)) | |
def argmax2(array): | |
return max(range(len(array)), key=lambda x: array[x]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment