The most frequent number

Write code · Challenge · §4.2, §7.2, §8.2 Giving back

Complete the function find_mode, which returns the number that appears most often in a list of numbers (the mode). The list has at least one number. If several numbers tie for most frequent, you may return any one of them. Do not use max(), count(), or sorted().

Starter code

def find_mode(nums):
    # Write your code here
    pass

print(find_mode([3, 1, 3, 2, 3]))

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.