Python dictionary object

Assignment Help Basic Computer Science
Reference no: EM132323046

1. You have been hired by a small software company to make 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 the sample run of your program:

Enter a phrase: Happy Birthday! exclaimed the sad, sad kitten

GLAD birthday exclaimed the BLEAK BLEAK kitten

Comment your source code and describe your code to someone who may be viewing it for the first time.

Reference no: EM132323046

Questions Cloud

What is the amount of goodwill acquired by josef ltd : Josef Ltd acquired 90% of the share capital and reserves of Peter Limited for $170,000. Share capital was $100 000 and reserves amounted to $62 000.
Understanding of the mintzberg model : Objective: Students will demonstrate their understanding of the Mintzberg model and how it can be applied to improve performance.
Keep track of vendor email addresses : Using Python programmingYour company needs a way to keep track of vendor email addresses.
Describe the managements decision-making process : Describe the concepts: Terms sales mix and its effect on break-even sales, Activity Based- Costing and include a discussion on why you think these topics.
Python dictionary object : The company has set you up with a sample thesaurus stored in a Python dictionary object. Here's the code that represents the thesaurus:
Remediation tie into information security maintenance : Describe how planning, risk assessment, vulnerability assessment, and remediation tie into information security maintenance
Prepare a schedule for showing budgeted cash receipts : Prepare a schedule for each month showing budgeted cash disbursements for Cloaks Company. Prepare a schedule for each month showing budgeted cash.
Personal computer name the backup solution : On your personal computer name the backup solution that you rely on the most. Why do you use that specific solution(s)?
Higher-numbered items : Consider the following locking protocol. All items are numbered, and once an item is unlocked, only higher-numbered items may be locked

Reviews

Write a Review

Basic Computer Science Questions & Answers

  .net framework basically constitutes which of the following

.net framework basically constitutes of which of the following?

  Draw a graph to represent example

(a) Draw a graph to represent this example, where the nodes are people and an edge connects two people if they shook hands.

  How much money did you earn

Several days later, you purchased the chicken back for $10 and then sold the chicken again to another person for $11. How much money did you earn?

  Find the probabilities that she spends

The probability that the subway is delayed is 40%. Find the probabilities that she spends, 0, 3, 6, 9, 12, and 15 dollars on coffee over the course of a five

  It auditor certifications and requirements

Use the Web to conduct research on IT Auditor Certifications. Write a report which provides and explains the following: 3 IT Auditor Certifications and Requirements

  Confident interval for the estimated mean

If the research firm wanted to be 90% confident in its estimates (z value for 90 percent = 1.645), what would be the confident interval for the estimated mean.

  Increase in the number of workers looking for jobs

The following are likely effects created by a Minimum Wage Regulation, based on the model presented in class, EXCEPT:

  Display information about the static field nokian95

Write a class GSMTest, which has to test the functionality of class GSM. Create few objects of the class and store them into an array. Display information about the created objects. Display information about the static field nokiaN95.

  Vulnerability disclosure-attack disclosure

What are the legal obligations (as well as protection for sharing) of companies about attacks on their systems and possible future attacks and vulnerabilities?

  Web page makes effective and consistent use of headings

Use search engine to determine the example of Web page which makes effective and consistent use of headings to organize Web page content.

  How much is the tax on this transaction before taking

Mimi purchased the set 5 years ago for $500,000. How much is the tax on this transaction before taking into consideration the 3.8% Medicare tax?

  Describe a series of record accesses

For each of the three self-organizing list heuristics (count, move-to-front, and transpose), describe a series of record accesses for which it would require the greatest number of comparisons of the three.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd