Skip to content

Instantly share code, notes, and snippets.

@fonnesbeck
Created September 16, 2015 14:14
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 fonnesbeck/2162c20d6661e8e683b6 to your computer and use it in GitHub Desktop.
Save fonnesbeck/2162c20d6661e8e683b6 to your computer and use it in GitHub Desktop.
Returning the most frequent value in a list
def most_common(lst):
return max(set(lst), key=lst.count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment