Question: In Python do the following: A: The text below misses a separator between the course and the grades. Create a regular expression to extract all

In Python do the following:

A: The text below misses a separator between the course and the grades. Create a regular expression to extract all the grades from the text and assign that value to the variable avg_grade.

text = """Intro_to_Python6.5 Calculus8.0 Advanced_deep_learning8.3 Compiler_construction6.0 """

Using:

regex = re.compile(pattern, flags=re.IGNORECASE) result = regex.findall(text)

B: Write a regular expression that extracts the sender, recipient and the subject from the email.

text = """From: Adam To: my classmates Subject: We can do better! Body: Focus hard, and we will be fine. """

Using the output:

print('{} says "{}" to {}'.format(result[0], result[2], result[1]))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!