Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions