Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 0 (3 points) Complete the getRegEx() function which returns a regular expression string to match any linear equations or inequations, such as the ones

image text in transcribedimage text in transcribed

Exercise 0 (3 points) Complete the getRegEx() function which returns a regular expression string to match any linear equations or inequations, such as the ones below. You may have any number of terms on the left hand side or the right hand side of the equation. You need to return a regular expression string such that when compiled, the .findall() method will parse the entire equation/inequation. Eg The equation: will parse into the list of tuples: It is worth noting that any of the linear equations/inequations can be parsed into separate groups with the parts the sign the coefficient, the variable, the equality/inequality symbol any of which may or may not be present. The first test cell will test against the above equations while the second test cell will test against some similar randomly generated equations In [ ]: import re def getRegEx) regex" # YOUR CODE HERE return regex In [ ]: # Test cell 1: test against the above equations (1 point) equation-1= '3x

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions