Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need program in python. 3. (30 points) Write a program that prompts the user to enter two strings, a file name and a word.

image text in transcribed

I need program in python.

3. (30 points) Write a program that prompts the user to enter two strings, a file name and a word. The program must identify the words separated by arbitrary strings of whitespace characters and find the number of occurrences of the word in the file. It must be case-insensitive. For example, if the given word is "the" and the file has The", it should be counted. Likewise, if the given word is "tHe" and the file has "the", it should be counted. In the provided file, "alice_short.txt", the program must find the number of occurrences for "it" to be 7. Assume that the user gives the inputs properly, so the program does not need to check if they are valid or not. Hint: You may use the built-in s.lower) or s.upper) function that converts all the letters in string, s, to lowercase or uppercase letters, respectively. When checking if the word given by the user is the same as a word in the file, convert both words to lowercase or uppercase letters before comparison to eliminate case sensitivity 5 0 3 5

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

Build It For The Real World A Database Workbook

Authors: Wilson, Susan, Hoferek, Mary J.

1st Edition

0073197599, 9780073197593

More Books

Students also viewed these Databases questions

Question

=+2 Why are international employment standards important to IHRM?

Answered: 1 week ago