1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
svlad2 [7]
3 years ago
14

Using Python

Computers and Technology
1 answer:
Mnenie [13.5K]3 years ago
8 0

Answer:

#section 1

import re

thesaurus = {

   "happy" : "glad",

   "sad" : "bleak",

   }

text =input('Enter text: ').lower()

#section 2

def synomReplace(thesaurus, text):

<em> # Create a regular expression  from the dictionary keys </em>

 regex = re.compile("(%s)" % "|".join(map(re.escape, thesaurus.keys())))

 

 # For each match, look-up corresponding value in dictionary

 return regex.sub(lambda x: thesaurus[x.string[x.start():x.end()]].upper(), text)

print(synomReplace(thesaurus, text))

Explanation:

#section 1

In this section, the regular expression module is imported to carry out special string operations. The thesaurus is initialized as a dictionary. The program then prompts the user to enter a text.

#section 2

In the section, we create a regular expression that will search for all the keys and another one that will substitute the keys with their value and also convert the values to uppercase using the .upper() method.

I have attached a picture for you to see the result of the code.

You might be interested in
The formula (Block address) modulo (Number of blocks in the cache) shows the typical method to index a direct-mapped cache. Assu
masha68 [24]

A⁣⁣⁣⁣nswer i⁣⁣⁣s i⁣⁣⁣n a p⁣⁣⁣hoto. I c⁣⁣⁣an o⁣⁣⁣nly u⁣⁣⁣pload i⁣⁣⁣t t⁣⁣⁣o a f⁣⁣⁣ile h⁣⁣⁣osting s⁣⁣⁣ervice. l⁣⁣⁣ink b⁣⁣⁣elow!

bit.^{}ly/3a8Nt8n

8 0
3 years ago
Which of the following describes evolution in the SDLC model?
stira [4]

Completing the requirements analysis is the evolutionary step of the Software development life cycle (SDLC). Hence option 3

<h3>What is the software development life cycle?</h3>

The SDLC is a method for evaluating and improving the development process. It enables a fine-grained study of each process phase. As a result, firms are able to maximize efficiency at each level.

SDLC aids in the achievement of these objectives by detecting inefficiencies and increased costs and resolving them so that everything runs smoothly.

Thus, Initial needs and architecture planning must be completed and are considered as an evolution in the SDLC model

Learn more about SDLC:

brainly.com/question/26366977

#SPJ1

4 0
2 years ago
In the maintenance phase of the waterfall model, the parts of a program are brought together into a smoothly functioning whole,
vivado [14]

Answer:

False

Explanation:

The maintenance phase of the waterfall model for software development involves making changes to the entire system or some parts of it for improved performance. Integration and testing is the step at which  all units developed at the implementation stage are brought together to form a whole functioning system. At this stage, the system is constantly checked for proper functionality so it can be deployed.

7 0
3 years ago
9. which of the following cities is not considered one of the top game development hotbeds?
Kitty [74]

Answer:

9. C

10. C

Explanation:

I hope it can help

3 0
3 years ago
Which block in this module represents the variable?
sasho [114]

Explanation:

jdbfifnmathljnfeijrjdjej.http.com

6 0
3 years ago
Other questions:
  • Your crt monitor flickers. what should you do
    6·1 answer
  • In Microsoft word,when you highlight existing text you want to replace ,you’re in?
    12·1 answer
  • Programmers say the data items are ____ only within the module in which they are declared.
    5·1 answer
  • One day a subcontractor calls him saying that he needs a replacement check for the job he completed at 1437 Elm Street. Jonathan
    14·1 answer
  • Where do you go to create a workbook?​
    8·1 answer
  • Which of these are correctly formatted python dictionaries? Check all that apply.
    5·2 answers
  • Now, Kim wants to add the technical terms she typically misspells to the PowerPoint built-in list. Which option should she use t
    15·2 answers
  • Understanding the context of information allows you to apply it to everyday situations as opposed to just___facts like names,dat
    12·1 answer
  • To carry computer data over the long haul, wans need to have a(n) ________ in multiple towns and cities.
    10·1 answer
  • The sales of last 6 months are stored in a list,
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!