Bubble sort with a flag


def bbsort_imp(a_List)
    numItems = len(aList)
    swapped = True 
    while swapped == True and n > 0:
        swapped = False
        for i in range(1, n):

            if aList[i] < aList[i -1]:
                aList[i], aList[i-1] = aList[i-1], aList[i]
                swapped = True
        n = n-1
    return aList



# Main


number = ["9" , "7", "8", "6", "1"]
print (bbsort_imp(myList)