# Reads in file one line at a time and # prints the contents of the file. in_file = "silly.txt" silly_file = open(in_file, "r") # a list containing all words in the file words_list = [] words_count = 0 for silly_line in silly_file: # split cuts a string up into a list of smaller strings words = silly_line.split(" ") words_list.extend(words) words_count = words_count + len(words) print(words_list) print(words_count) silly_file.close()