Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me with this question using python , Finding Unique Words in a File In this exercise you will read the words contained in

Please help me with this question

using python ,

Finding Unique Words in a File In this exercise you will read the words contained in a file and process them. Your program must create a list of the unique words found in the file (ignoring case). Words are only composed of alphabetic characters; digits and punctuation should be removed. Write a fruitful function named open_file() that prompts the user for a file name. The function then attempts to open the file for reading. When it is successful it returns the file handle. If the named file is not readable then the function displays a message and prompts for another file name. Use the os.path.isfile() function to check to see if the file exists. Do not use exception handling in this program. Write a main driver that uses open_file() to get a file handle for the file that the user requests. Then reads the file extracting all the words ignoring punctuation and non-alphabetic characters. Either during the reading process or after the entire file has been read (your choice) create a list containing the unique words. Change all words to lowercase before you process them. Then display a list of these words sorted in alphabetic order. As one of the tests for your final submission you should use the text of Robert Frosts Fire and Ice which is contained in FireAndIce.txt. You also should use Leunigs How To Get There contained in GettingThere.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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

Define the term "Leasing"

Answered: 1 week ago

Question

What do you mean by Dividend ?

Answered: 1 week ago

Question

Experience with SharePoint and/or Microsoft Project desirable

Answered: 1 week ago

Question

Knowledge of process documentation (process flow charting)

Answered: 1 week ago