Skip to content

Instantly share code, notes, and snippets.

@magusafr
Created September 2, 2018 06:46
Show Gist options
  • Save magusafr/aed26790416b03ad1962d867ca44615a to your computer and use it in GitHub Desktop.
Save magusafr/aed26790416b03ad1962d867ca44615a to your computer and use it in GitHub Desktop.
mode first for the most occur of number
data=[1,2,5,10,-20,5,5,7, 7, 7, 7]
mode = [ data.count(data[i]) for i in range(len(data))]
print(data[mode.index(max(mode))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment