Question: (IN PYTHON) Problem 1 Write a function word_count() that performs the following actions: Opens a file called novel.txt. You can assume that the file exists
(IN PYTHON) Problem 1
Write a function word_count() that performs the following actions:
Opens a file called novel.txt.
You can assume that the file exists and is located in the same directory as your code file.
Reads in the contents of the file, and stores it in a variable called text.
Uses the split() function to obtain a list containing all of the individual words in text.
For this question, assume that all words will be separated by spaces.
Returns the number of words in the list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
