# This implements the SelectionSort algorithm you need
# for the distill.py program in Lab 7.  
def main():
    F = open( "randomWords.txt", "r")
    L = []
    for line in F:
        L.append( line.strip())
    FindLargest(L,  10)
    for i in range(0, 10):
        print( L[i])

def FindLargest(L, k):
    # This puts the k largest elements at the front of L
    for i in  range(0, k):
        big = i # small is the index of the smallest element
                  # starting at index j
        for j in range(i, len(L)):
            if L[j] > L[big]:
                big = j
        t = L[i]
        L[i] = L[big]
        L[big] = t
        

main()
