import time

def main():
    F = open( "words25K.txt", "r")
    L = []
    for line in F:
        L.append( line.strip("\n") )

    S = set(L)
    print( "starting set searches")
    start = time.perf_counter()
    count = 0
    for word in L:
        if word in S:
            count = count+1
    end = time.perf_counter()
    setTime = end-start
    print( "Set searches took %.6f seconds"%setTime)

    print( "starting list searches")
    start = time.perf_counter()
    count = 0
    for word in L:
        if word in L:
            count = count+1
    end = time.perf_counter()
    listTime = end-start
    print( "List searches took %.6f seconds"%listTime )
    print( "Lists took %d times longer than sets."%(int(listTime/setTime)))

main()
