Question: 
Write a function to find the item with maximum occurrences in a given list.


Model's Code:
def max_occurrences(lst):
    from collections import Counter
    counts = Counter(lst)
    max_count = max(counts.values())
    return min(key for key, value in counts.items() if value == max_count)



Sample Correct Code:
def max_occurrences(list1):
    max_val = 0
    result = list1[0] 
    for i in list1:
        occu = list1.count(i)
        if occu > max_val:
            max_val = occu
            result = i 
    return result


Asserts:
assert max_occurrences([2,3,8,4,7,9,8,2,6,5,1,6,1,2,3,4,6,9,1,2])==2
assert max_occurrences([1, 3,5, 7,1, 3,13, 15, 17,5, 7,9,1, 11])==1
assert max_occurrences([1, 2, 3,2, 4, 5,1, 1, 1])==1


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: PASS

Test 658 of 974: 493/658 (74.92401215805471%): success