I have been trying to figure out how to find the mode of a list WITHOUT using sorting functions nor importing any modules for quite awhile now... Here's what I have so far:
d = {}
def mode():
    for i in mode:
        if i in d:
            d[i] += 1
        else:
            d[i] = 1
    return
How do I find the output such as the following:
print(mode([1, 5, 6, 1, 1, 2]))
[1]
print(mode([5, 6, 7, 8, 9]))
[5, 6, 7, 8, 9]
Thanks a bunch!
 
     
    