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 takespython 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!