# Count the number of unique words in a text file and # make a set of all the words in the file word_set = set() silly_file = open("silly.txt", "r") for line in silly_file: # print(line, end="") word_list = line.split() print(word_list) word_set = word_set | set(word_list) silly_file.close() print("Number of unique words in file:", len(word_set)) print("Words in file:", word_set)