csc-python-solutions/13/8 - a la Mode.py

8 lines
161 B
Python
Raw Normal View History

2021-02-18 07:56:15 +00:00
def mode(L):
frequency = [0]*10
for i in L:
frequency[i] = frequency[i] + 1
for i in range(0, 10):
if frequency[i]==max(frequency):
return i