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.
Answer:
The reason that programming is so important is that it directs a computer to complete these commands over and over again, so people do not have to do the task repeatedly. Instead, the software can do it automatically and accurately.
Explanation:
Answer:
1. Semantic
2. modifies
Explanation:
Semantic HTML is understood by the traditional browser, and semantic tags are the one that ensures not just presentation, but also adds the meaning to the webpage. And hence, img here is both semantic as well as presentational. Hence, the first option is semantic. And the IMG modifies the meaning of the web page. The description is done by the text. And hence the second option is modified.
.