Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Nataila/7653082 to your computer and use it in GitHub Desktop.
Save Nataila/7653082 to your computer and use it in GitHub Desktop.
mylist = [2,2,2,2,2,2,3,3,3,3]
mylist.sort()
myset = set(mylist)
for item in myset:
print mylist.count(item), " of ", item, " in list"
@angellaugh
Copy link

thanks, get sort and reverse methods.

@kelein
Copy link

kelein commented Apr 28, 2018

count = {}
for item in mylist:
      count[item] = mylist.count(item)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment