# Uses a list to count words in Moby-Dick, # and measures/prints the code's runtime. import time def main(): # count the unique words in the file start = time.clock() words = [] with open("mobydick.txt") as file: for word in file.read().lower().split(): if word not in words: words.append(word) end = time.clock() # report results print("Unique words =", len(words)) print("Runtime:", round(end - start, 2), "sec") main()