Skip to content

Instantly share code, notes, and snippets.

@tsangwpx
Created July 29, 2021 19:50
Show Gist options
  • Save tsangwpx/971e70bd93eb9653f26e9d6e38557896 to your computer and use it in GitHub Desktop.
Save tsangwpx/971e70bd93eb9653f26e9d6e38557896 to your computer and use it in GitHub Desktop.
argmin in pure Python
def argmin(seq: Sequence[int]):
indices = range(len(seq))
return min(indices, key=seq.__getitem__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment