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
Interruption attacks are also called ___ attacks:
Lelu [443]

Answer:

Interruption attack are also referred to as Denial Of Service(DOS) attack.

Explanation:

Interruption attack are also called denial of service.The main aim of  interruption attack or Denial Of Srvice attack is to make resources unavailable.

For example:- wordpress.com had an DOS attack that took down their servers hence the service was unavailable for it's users.

Hence we conclude that the answer to this question is Denail of Service (DOS).

4 0
3 years ago
A network with 6 bits remaining for the host portion will have how many usable hosts?​
Readme [11.4K]
<span>A network with 6 bits remaining for the host portion will have 62 usable hosts. The netmask is </span><span>255.255.255.192/26, the shorthand is [6-bit] which is equal to the number of addresses as <span>= 62 hosts + 1 bcast + 1 net base</span></span>
6 0
2 years ago
The following statement calls a function named half, which returns a value that is half
nadezda [96]

Answer:

function half(number) {

     let result = number/2;

     return result;

}

Explanation:

4 0
3 years ago
Who plays warzone im a roze sweat and ill try to carry with loadout
alexira [117]

Answer:

I type play warzone- If u wanna add me my user is Chachee_Girl. Dont ask- and im on ps5

8 0
2 years ago
Suppose that a 64MB system memory is built from 64 1MB RAM chips. How many address lines are needed to select one of the memory
alexdok [17]

Answer:

6 address lines

Explanation:

The computation of the number of address lines needed is shown below:

Given that

Total memory = 64MB

= 2^6MB

=2^{26} bytes

Also we know that in 1MB RAM the number of chips is 6

So, the number of address lines is 2^{26} address i..e 26 address lines

And, the size of one chip is equivalent to 1 MB i.e. 2^{20} bytes

For a single 1MB chips of RAM, the number of address lines is

\frac{2^{26}}{2^{20}} \\\\= 2^6 address

Therefore 6 address lines needed

5 0
3 years ago
Other questions:
  • List and define the types of System Software. How does System Software differ from Applications Software?
    12·1 answer
  • In Microsoft Word, when you highlight existing text you want to replace, you are in what
    11·1 answer
  • True or false A ClassB fire involves live electrical equipment
    5·1 answer
  • Machu Picchu is located in modern day _______<br><br>​
    14·2 answers
  • The Spanning Tree Protocol operates at the Network layer of the OSI model.
    13·1 answer
  • The difrent between valid deductive argument and strong inductive argument? At least 2 example​
    6·1 answer
  • You want to be able to identify the services running on a set of servers on your network. Which tool would best give you the inf
    11·1 answer
  • Discuss five domains of Instructional technology​
    7·1 answer
  • Fre.....ee p......oint....s pt 2
    10·2 answers
  • Escribe 10 ejemplos de lo que consideras un byte
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!