subject

Using python

you have been hired by a small software company to create a "thesaurus" program that replaces words with their synonyms. the company has set you up with a sample thesaurus stored in a python dictionary object. here's the code that represents the thesaurus:

# define our simple thesaurus
thesaurus = {
"happy": "glad",
"sad" : "bleak"
}
the dictionary contains two keys - "happy" and "sad". each of these keys holds a single synonym for that key.

write a program that asks the user for a phrase. then compare the words in that phrase to the keys in the thesaurus. if the key can be found you should replace the original word with a random synonym for that word. words that are changed in this way should be printed in uppercase letters. make sure to remove all punctuation from your initial phrase so that you can find all possible matches. here's a sample running of your program:

enter a phrase: happy birthday! exclaimed the sad, sad kitten
glad birthday exclaimed the bleak bleak kitten

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:20
The liang book has an example called which is a javafx application that reads the javabook database using a preparedstatement object. using it as a guide, create a similar application called findbooks. it will read a list of authors from the bookdb created in problem 1 and display them in a listview. if the user selects an author, it should display the author's book titles in a textarea.
Answers: 2
question
Computers and Technology, 21.06.2019 22:30
Provide an example of a project that combines the three principles of lean six sigma with business project management (bpm) and services oriented architecture (soa). identify the elements of the project that comply with each of three principles.
Answers: 1
question
Computers and Technology, 22.06.2019 02:30
If you turn on the lock alpha button , what happens
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
1)consider the following code snippet: #ifndef book_h#define book_hconst double max_cost = 1000.0; class book{public: book(); book(double new_cost); void set_cost(double new_cost); double get_cost() const; private: double cost; }; double calculate_terms(book bk); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_cost should be removed since header files should not contain constants.c)the definition of book should be removed since header files should not contain class definitions.d)the body of the calculate_terms function should be added to the header file.
Answers: 1
You know the right answer?
Using python

you have been hired by a small software company to create a "thesaurus" pro...
Questions
question
Mathematics, 16.10.2019 00:30
question
English, 16.10.2019 00:30
question
History, 16.10.2019 00:30