nums = [1,2,3,1,1,3,3,4,4,3,5] #list counts = collections.Counter(nums) # create a dict of counts #using counts.get() fun as custom function return max(counts.keys(), key=counts.get)