Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help in this python program. please help!!! I have the regex for part one: (-?d+)s*/s*(d+) *([+*/-])s*(-?d+)s*/(d+) but now i need help in part
I need help in this python program. please help!!!
I have the regex for part one: (-?\d+)\s*\/\s*(\d+) *([+*\/-])\s*(-?\d+)\s*\/(\d+)
but now i need help in part 2.
Write a regular expression patt that can be used to extract (numerator,denominator,operator,numerator,denominator) from a string containing a fraction, an arithmetic operator, and a fraction. You may assume there is a space before and after the arithmetic operator and no spaces surrounding the character in a fraction. And all fractions will have a numerator and denominator. Example: >>s 23/45 14/9" >>>re.findal I (patt,s) >>S"-23/45 1419 >>>re.findal I (patt,s) In general, your code should handle any of the operators +, * and I. -, Note: the operator module for the two argument function equivalents of the arithmetic (and other) operators Write a regular expression patt that can be used to extract (numerator,denominator,operator,numerator,denominator) from a string containing a fraction, an arithmetic operator, and a fraction. You may assume there is a space before and after the arithmetic operator and no spaces surrounding the character in a fraction. And all fractions will have a numerator and denominator. Example: >>s 23/45 14/9" >>>re.findal I (patt,s) >>S"-23/45 1419 >>>re.findal I (patt,s) In general, your code should handle any of the operators +, * and I. -, Note: the operator module for the two argument function equivalents of the arithmetic (and other) operators
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started