Question: Python programming question: Write a function getNumDays(fname) that counts how often each weekday is mentioned in a text file with name fname, and writes the

Python programming question:

Python programming question: Write a function getNumDays(fname) that counts how often each

Write a function getNumDays(fname) that counts how often each weekday is mentioned in a text file with name fname, and writes the results to a text file with name NumberOfDays. txt. For example, I ran getNumDays("Pride_and_Prejudice.txt ) : >>> getNumDays('Pride_and_Prejudice. txt') To view the results go to NumberOfDays. txt 'Thanks for using the getNumDays() function" Below is a snapshot of Number Of Days. txt: . . . NumberOfDays.txt Monday is mentioned 9 times in Pride_and_Prejudice. txt Tuesday is mentioned 12 times in Pride_and_Prejudice. txt Wednesday is mentioned 9 times in Pride_and_Prejudice. txt Thursday is mentioned 4 times in Pride_and_Prejudice. txt Friday is mentioned 1 times in Pride_and_Prejudice. txt Saturday is mentioned 17 times in Pride_and_Prejudice. txt Sunday is mentioned 9 times in Pride_and_Prejudice. txt Notes: Use the days of the week as written in the sample output. Do NOT create seven separate write statements. Do not be concerned about case of the letters or punctuation. Count only days as shown in the file snapshot. Close the input and output files. Before leaving the function, print the message "To view the results go to NumberOf Days.txt'

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 Programming Questions!