QUESTION

Text
Image

Using Python

What am I doing wrong?

This is what I'm supposed to do


Processing the File Create a markdown cell with a level 2 header that reads "Processing the File". Add unformatted text explaining that you will now use the process_file() function to read and process the contents of the file tale_of_two_cities.txt. Use the process_file() function to read in the file tale_of_two_cities.txt, storing the returned list into a variable named words. Then print the message shown below with the $\mathbf{x x x x}$ characters replaced with the number of elements in the list words. Make sure that the output message is formatted correctly. There should be exactly one space between any two consecutive words or numbers in the sentence. There are $x x x x$ words contained in the file. We will now print the first few words contained in the novel. Create a new code cell to print the first 20 words of the list words. Use list slicing to select the first 20 words. Do not use a loop in this code cell.

This what I did, and it's not working. The text file is save in the same place and everything.


Processing the File Will be using the process_file0 function to read and process the contents of the file tale_of_two_cities.txt. In [7]: words $=$ (process_file(tale_of_two_cities.txt)) $--$ NameError Traceback (most recent call las t) //Desktop/Cosc 130/Projects/project 2/word_count.py in <module> $--->1$ words $=$ (process_file(tale_of_two_cities.txt) NameError: name 'tale_of_two_cities' is not defined​​​​​​​

Public Answer

9CVBB6 The First Answerer