I was using CodeWars and I was training with this 6 kyu kata, and while it seemed simple enough I keep on getting issues and errors with my code. It works on most of them but for some it just doesn't delete the elements. And it seems so random like there is no reason behind why it's cutting off. What's going on?
def delete_nth(order,max_e):
order.reverse()
for e in order:
if order.count(e) > max_e:
order.remove(e)
order.reverse()
return order