Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for The Most Frequent by Dominikamalinowska
def most_frequent(data):
i=0
pom=0
while i in range(len(data)):
if data.count(data[i])>pom:
pom=data.count(data[i])
temp=data[i]
i=i+1
return temp
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert most_frequent([
'a', 'b', 'c',
'a', 'b',
'a'
]) == 'a'
assert most_frequent(['a', 'a', 'bi', 'bi', 'bi']) == 'bi'
print('Done')
Dec. 10, 2017