# Count the number of words in a text file and # make a list of all the words in the file num_words = 0 big_list_of_words = [] flat_list_of_words = [] silly_file = open("silly.txt", "r") for line in silly_file: # print(line, end="") word_list = line.split() print(word_list) num_words += len(word_list) big_list_of_words.append(word_list) flat_list_of_words.extend(word_list) silly_file.close() print("Total words in file: ", num_words) print("Words in file:", big_list_of_words) print("Flat list of words in file:", flat_list_of_words)