Question: python problem 2) Word count Write a function wordcount (Ename) which takes in a string fname, opens the file at location Ename, and counts the
python problem
2) Word count Write a function wordcount (Ename) which takes in a string fname, opens the file at location Ename, and counts the number of words in the file. Assume that word" here refers to any sequence of one or more consecutive non-whitespace characters. Create a text file in the same folder as your Python file to test your function. Then test it on the Python file itself (Python file are text files, so there's nothing to stop you from reading a file as you run it). Be sure to count the number of "words in both files manually to confirm that your function works as intended. Hint: The .split and .strip string methods may be helpful here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
