Finding the mode and frequency of items in a Python list
Question: How would you find the mode and frequency of items in a Python list?

This is what I have so for:

    
    
    elif user_option == 7:
        for score in scores_list:
            count = scores_list.count(score)
            print ("mode(s), occuring" + str(count) + ":")
            print(score)
    

What I need to do is print out the scores that appear the most if the user
inputs a set of scores where 2 appear at the same amount of time and I also
have to display the actual score. But this is what I get when I test it:

    
    
    Select an option above:7
    mode(s), occuring2:
    45.0
    mode(s), occuring2:
    45.0
    mode(s), occuring1:
    67.0
    


Answer: if you are trying to count frequency of an item of a list try this:

    
    
    from collections import Counter
    data = Counter(your_list_in_here)
    data.most_common()   # Returns all unique items and their counts
    data.most_common(1)  # Returns the highest occurring item
    

