scoreSettler2.py

def sorter(ar=[], reverse=False):                                                
    i = 0                                                                        
    while i <= len(ar):                                                          
        change = False                                                           
        try:                                                                     
            x = ar[i]                                                            
            y = ar[i+1]                                                          
            if not reverse and x > y:                                            
                ar[i] = y                                                        
                ar[i+1] = x                                                      
                change = True                                                    
            elif reverse and x < y:                                              
                    ar[i] = y                                                    
                    ar[i+1] = x                                                  
                    change = True                                                
            else:                                                                
                    i += 1                                                       
                                                                                 
            if change and i > 0:                                                 
                i = 0                                                            
        except IndexError:                                                       
            break                                                                
    return ar                                                                    
                                                                                 
                                                                                    
def scoreSettler(ar=[], maxs=0):                                                 
    r = sorter(ar, reverse=True)                                                 
    return [x for x in r if x <= maxs]                                              
                                                                                    
ar = [100, 3333333, 879200, 1172100, 1141800, 933900, 1177200, 1190200, 1110100, 
      1158400, 985600, 1047200, 1049100, 1138600, 1170500, 1064500, 1190000,        
      1050200, 1090400, 1062800, 1061700, 1218000, 1068000, 1127700, 1144800,       
      1195100]                                                                      
                                                                                    
print scoreSettler(ar, 1218000)