Question: code In python. [1p] Implement class MathematicalExpression that stores a mathematical expression in a text format. [2p] Implement support for the plus operator, where the
![code In python. [1p] Implement class MathematicalExpression that stores a mathematical](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66dc96df797e2_57466dc96dedced6.jpg)
code In python.
[1p] Implement class MathematicalExpression that stores a mathematical expression in a text format. [2p] Implement support for the plus operator, where the first argument is always Mathematicalexpression instance and second argument can be either numeric (int, float) or also Mathematicalexpression instance. The result of the addition is a new MathematicalExpression instance. 2. [1p] Implement the equality operator - two Mathematicalexpression instances are equal if and only if the expressions are equal (not only the results). Spaces in the expressions do not matter. 3. [2p] Implement a class IntegerExpression that inherits from MathematicalExpression and which expression can only contain integer numbers (not floating point numbers, i.e. "3+3" not "3.3+3"). Ensure this by raising an appropriate exception. Try to reuse as much code from Mathematicalexpression as possible. Mathematicalexpression example: >> MathematicalExpression("2 +3")== Mathematicalexpression ("2+3") True True
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
