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
What is not a benefit of exploring tabs and groups in Microsoft Word?
MrRa [10]
Microsoft's<span> direct participation </span>not<span> only assures you that MOAC textbook content is accurate and current</span>
8 0
3 years ago
Read 2 more answers
¿Qué creo que debe considerar una empresa para elegir ellugar en el cual va a desarrollar su actividad económica osu emprendimie
zhannawk [14.2K]

Answer:

sorry I don't speak that language

8 0
2 years ago
To bundle links together in order to improve bandwidth availability and redundancy, what protocol is used
Daniel [21]

Answer:

Link Aggregation Control Protocol

Explanation:

Link Aggregation Control Protocol can be used to assist in the formation of port channel bundles of physical links.

Link Aggregation Control Protocol is an IEEE standard defined in IEEE 802.3ad. LACP lets devices send Link Aggregation Control Protocol Data Units (LACPDUs) to each other to establish a link aggregation connection.

8 0
2 years ago
Alexander studies sitting on the edge of his bed with his laptop on his lap. he complains of a sore neck. how can he best improv
kumpel [21]

The way in which Alexander can best improve his study area is that: D. he can put his computer on a desk and sit in a comfortable chair.

<h3>What is a laptop?</h3>

A laptop can be defined as a small, portable type of computer that is designed and developed by embedding both a mousepad and keyboard on it.

Also, it is usually light enough to be placed on an end user's lap while he or she is working.

In this scenario, the way in which Alexander can best improve his study area is that he can put his computer on a desk and sit in a comfortable chair.

Read more on a laptop here: brainly.com/question/26021194

#SPJ4

7 0
1 year ago
Access fundamentally refers to the ability of a subject and a(n) ___________ to interact.
mars1129 [50]

Answer:

The correct word for the blank space is: object.

Explanation:

Access Control System (<em>ACS</em>) is a computer structure that allows or restricts users to access to features and information of a server. ACS is used to protect confidential data and to make sure the servers are going to be used by authorized users which diminish malfunctions. One of the basic principles of ACS is letting subjects and objects to interact properly.

5 0
3 years ago
Other questions:
  • Remember that the function "main" takes optional parameters, these being common:
    10·1 answer
  • Let's assume that the smallest possible message is 64 bytes (including the 33-byte overhead). if we use 100base-t, how long (in
    10·1 answer
  • A communication medium which allows receivers to observe multiple cues, such as body language and tone of voice, and allows send
    15·1 answer
  • The site is not allowing me to purchase the subscription. Please help?
    12·1 answer
  • What is the difference between a workbook and a worksheet?
    14·2 answers
  • What are the advantages of saving files in a cloud? <br>Please help!! ​
    11·2 answers
  • Correct all the mistakes in the following sentence:
    15·2 answers
  • Explain the working principle of computer with suitable diagram​
    15·1 answer
  • What is the vibrating or buzzing of a hand controller known as?.
    7·1 answer
  • What information will she need to know in order to obtain assistance from the chief medical officer to reduce the number of deli
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!