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
marysya [2.9K]
4 years ago
10

The contains_acronym function checks the text for the presence of 2 or more characters or digits surrounded by parentheses, with

at least the first character in uppercase (if it's a letter), returning True if the condition is met, or False otherwise. For example, "Instant messaging (IM) is a set of communication technologies used for text-based communication" should return True since (IM) satisfies the match conditions." Fill in the regular expression in this function:
Computers and Technology
1 answer:
STALIN [3.7K]4 years ago
7 0

Answer:

Following are the code to this question:

import re#import package regular expression

def contains_acronym(val): #defining a method contains_acronymn that accepts text value in parameter

   match= r"\([A-Z1-9][a-zA-Z1-9]*\)"#defining match variable that uses upper case, number, and lower case value  

   r= re.search(match, val)#defining r varaible that uses search method to search values

   return r!= None #use return keyword  

val="Instant messaging (IM) is a set of communication technologies used for text-based communication"

print(contains_acronym(val))#use print function to call method and print its return value

Output:

True

Explanation:

In the above-given code, first, we import package "regular expression" this package is used to check the string, In the next line, a method "contains_acronym" is defined that accepts a "val" variable in its parameters.

  • Inside the method, the "match" variable is defined that holds the uses upper case, number, and lower case values, and in the r variable the "search" method is defined, that search these and return the value.
  • Outside the method, val variable is defined, that store string value and use print method is used that calls the method "contains_acronym".      
You might be interested in
It is a set of computer instructions​
soldier1979 [14.2K]

Answer:

computer software is a set of computer instructions

8 0
3 years ago
Why must programs written in a high-level language be translated into machine language?
eimsori [14]
The only thing that a computer actually understands is machine language. English-like constructs are gibberish to a computer, so they need to be translated by a compiler to machine language to run natively.
4 0
3 years ago
Software that instructs the computer how to run applications and controls the display/keyboard is know as the
andreev551 [17]
Answer:
OS or operating system
5 0
4 years ago
Which task is most suitable for creating an algorithm?
Anna71 [15]
A.
-HomeTaey
(ask anytime)
if I get it wrong, sorry
8 0
3 years ago
Read 2 more answers
How would you describe the relationship between blocks of code and commands?<br>HELP​
Karolina [17]

Answer:

Code and Commands have similar programs coding has only one thing to do or done but commands can be told anytime by an input device.

Explanation:

hope this helps.

7 0
3 years ago
Other questions:
  • *****NEED HELP ASAP!!!! COMPUTER HELP!!!! PLEASE!**
    13·1 answer
  • What does it mean to design,<br> implement, and maintain computer<br> systems?
    15·1 answer
  • Which criterion can be used to select the appropriate type of network media for a network?
    8·1 answer
  • Which search engine do you prefer? Why
    15·2 answers
  • What is the purpose of the New Window command?
    7·2 answers
  • Software licensed using the Open Software Initiative (OSI) definition
    5·2 answers
  • Which of these is NOT a benefit of being connected 24/7?
    11·1 answer
  • How do I give Brainliest?? I'll give brainliest...
    13·2 answers
  • Technician A says that a camshaft must open and close each valve at exactly the right time relative to piston position. Technici
    11·1 answer
  • after confirming the removal of a virus from a computer, how should the technician ensure and verify the full functionality of t
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!