I went around many forums without finding my solution because most uses at least one pre-function.
I must return the statistical mode of a sorted list. Warning, because I can't use any function, like: Max, Count, key, set.
My function be in o(n)
I try with my own fonction :
def mode_liste (lis_resultat):
"""lis_resultat: sorted list"""
d=0
e=0
for i in range (len(lis_resultat)-1,1,-1):
if (lis_resultat[i]==lis_resultat[i-1]):
e+=1
else:
if (d<=e):
res=lis_resultat[i-1]
d=e
e=0
return res
But this function don't work with a list of less than 2 items, and I know that it's not the good solution