array = [1,2,3,4,5,6,7,8,9,0,8,6,7,5,4,3,4,3,8]

dict = {}                                       #create a dictionary
for elem in array:                              #iterate thru elements
    try:                                        #try:
        dict[elem] += 1                         #add 1 to the element's value
    except:                                     #if unsuccessful, element must not be in dictionary 
        dict[elem]  = 1                         #add the element with value 1 to dictionary

listOfTuples = sorted(dict.items(), key=lambda elem: elem[1], reverse=True)     #sort by highest value 

min   = 2                                       #set minimum number of occurrence
modes = []                                      #create an empty list

for i in range(len(listOfTuples)):              #loop through the sorted list of tuples
    tuple = listOfTuples[i]
    (elem, occur) = tuple
    if occur < min:                             #if occurrence < min
        break                                   #we are done, no need to continue
    modes.append(elem)                          #add the element to the list of modes
    min = occur                                 #save the number of occurence as min 
    
print(modes)