Create a function that takes two arguments: a list and a number. In the list (the first argument), if an element occurs more than N
times (the second argument), remove the extra occurrences and return the result.
delete_occurrences([1, 1, 1, 1], 2) ➞ [1, 1]
delete_occurrences([13, True, 13, None], 1) ➞ [13, True, None]
delete_occurrences([True, True, True], 3) ➞ [True, True, True]
- Do not alter the order of the original list.