Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i.i.i can you please do a python class library called Sentence that evaluates and manipulates an English sentence. Your program will be called Sentence.py and

i.i.i can you please do a python class library called Sentence that evaluates and manipulates an English sentence. Your program will be called Sentence.py and contain the following class attributes and methods: A constructor that takes a sentence string as input. The default value for the constructor should be an empty string Converts the sentence to a list attribute o First remove all punctuation The sentence must be a private attribute in the class get_all_words Method to get all the words in a sentence Takes no arguments Return: all the words in the sentence as a list get_word Method to get one desired word from the sentence Arguments: Index location of desired word Return: The single word or an empty string for a number outside the range It is okay for the program to crash on a noninteger argument set_word Changes the word at a given index location in sentence to a new word Arguments: index, new_word Does not return anything The word change must persist within the instance scramble Scrambles the words in a sentence Takes no arguments Return: a scrambled list of all the words in a sentence o This does not change the sentence attribute in your sentence instance A repr method use the builtin method Return: The sentence list as a single string, with a period at the end In Sentence.py, include a unit test that does the following: Runs inside an if __name__ block Instantiates the class with a sentence of your choice Validates set_word() method in that instance to demonstrate it works correctly o Use assert command when checking for errors At the end of your unit test, print: o a message that the sentence worked correctly For example Sentence unit test successful o the original version of your sentence o the scrambled version of your sentence o the final version of your sentence

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

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

=+5 Does this case provide an example of the future for IHRM?

Answered: 1 week ago

Question

=+4 How did it affect HR?

Answered: 1 week ago