Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1Write a regular expression pattern that matches a single argument: an optional name and equal sign followed by an integer (for simplicity, we will assume

1Write a regular expression pattern that matches a single argument: an optional name and equal sign followed by an integer (for simplicity, we will assume here that all arguments are integers). Python names start with an alphabetic or underscore character, and continue with any alphabetic, numeric, or underscore characters. Integers have an optional sign followed by some non-zero number of digits. Allow no spaces in the text. Matches should have two named groups: name and value. For example, if we execute

m = re.match(the-pattern,'x=-2)thenm.groupdict()returns{'name': 'x', 'value': '-2'}.

2Write a regular expression pattern that matches a single parameter: an optional * followed by a name (assume no spaces are between them) optionally followed by an equal sign and an integer (for simplicity, we will assume here that all default arguments are integers). Python names start with an alphabetic or underscore character, and continue with any alphabetic, numeric, or underscore characters. Allow no spaces in the text. Matches should have three named groups: star (might be '* or None), name, and value. For example, if we execute

m = re.match(the-pattern,'x=-2) then m.groupdict() returns {'star': None, 'name': 'x', 'value': '-2'}. This pattern is actually very similar to the one you wrote in part 4a, which is why it is worth only 1 point.

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

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

=+(2.9) PUAK =EP(A) - EP(ANA,) k=1 i

Answered: 1 week ago