Find the most common element in a list

A simpler one-liner:

def most_common(lst):
    return max(set(lst), key=lst.count)

Leave a Comment