Question: Problem 1 (10 points): highlight (pattern, string) Write a Python function named highlight (), which takes a raw string specifying a regex pattern as the

Problem 1 (10 points): highlight (pattern, string) Write a Python function named highlight (), which takes a raw string specifying a regex pattern as the first argument, called pattern, and a string as the second argument, called string. The function will compile pattern and apply the compiled pattern to string. If a match is found, then the function will return a string in which the matched substring of string is enclosed in angle brackets. If no match is found, the function should return None. For example, suppose that: pattern = r'[a-zA-Z]\d' string "ShepardN7" returns: "Shepard
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
