Skip to content

Instantly share code, notes, and snippets.

@eyaltrabelsi
Created July 6, 2019 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyaltrabelsi/7fc11068d55c560deaff1006ff1b1b03 to your computer and use it in GitHub Desktop.
Save eyaltrabelsi/7fc11068d55c560deaff1006ff1b1b03 to your computer and use it in GitHub Desktop.
Python trick Finding the index of the min/max item in an iterable
>>> a = [2, 3, 1]
>>> min(enumerate(a),key=lambda x: x[1])[0]
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment