def word_to_keep(word, freq): """ return true if word has a length of 5 to 9, a distinct number of characters of at least four, and a frequency of more than 2000000. Write the body of word_to_keep below. """ # File download from https://www.kaggle.com/datasets/rtatman/english-word-frequency input_filename = "unigram_freq.csv" output_filename = "hangman_words.txt" outfile = open(output_filename, 'w') with open(input_filename, 'r') as infile: # write the code to throw away the heading line (line #1) here. for line in infile: # Remove leading/trailing whitespace and check if not empty line = line.strip() # Write the code to prepare the variables word and freq from # the variable line here. We can then use word and freq to call # word_to_keep. Note that freq is an int. if word_to_keep(word, freq): outfile.write(word+'\n') outfile.close()