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
In database software, which option is the most appropriate menu choice or command to use if you want to change the format of the
sleet_krkn [62]

Answer:

I think it's d

Explanation:

             

4 0
2 years ago
I've been stuck on these two basic javascript assignments for an embarrassingly long time. The teacher refuses to help me and th
user100 [1]

Answer:

it is 29 0ver 30

Explanation:

i took the quiz

5 0
2 years ago
How does segmenting your network increase network security?
lys-0071 [83]

Answer:

By segmenting networks, it becomes easier to protect the most sensitive data that you have on your internally-facing network assets. The creation of a layer of separation between servers containing sensitive data and everything outside of your network can do wonders to reduce your risk of data loss or theft.

Explanation:

PLEASE MARK ME AS BRAINLIEST

5 0
3 years ago
The _________ attack exploits the common use of a modular exponentiation algorithm in RSA encryption and decryption, but can be
coldgirl [10]

Answer:

The answer is "timing".

Explanation:

  • The time attack would be a security vulnerability that enables attackers that identify computer systems or network security issues by analyzing the period of the program's reaction to multiple levels.  
  • It is used in both RSA encryption and decryption of the modular exponentiation method but could be modified for just about any system not seem running in a fixed period.
6 0
2 years ago
For this question <br> Translate to assembly language!!!!!!!
svetoff [14.1K]

Answer:

Javascript, because of the use of commas at the end of each line and the while operator using commas to hold params.

6 0
2 years ago
Other questions:
  • Which of these is a major mobile game developer?
    15·2 answers
  • How can investors receive compounding returns
    13·1 answer
  • We have seen that Internet TCP sockets treat the data being sent as a byte stream but UDP sockets recognize message boundaries.
    13·1 answer
  • Implementing information systems has economic, organizational, and behavioral effects on firms. Information technology, especial
    14·1 answer
  • Blender is used by which video game team member?
    15·1 answer
  • ```{r}
    11·1 answer
  • The current in a resistor is 5.0 A, and its power is 60 W. What is the voltage?
    12·2 answers
  • Can development and conservation of environment go hand-in-hand? Explain your point of view
    8·1 answer
  • 3. Find the best.
    13·1 answer
  • Why is it now difficult for computer technology to maintain the pace of
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!