```python
import sympy as sym
from IPython.display import display,Math



# Please enter the value as 3*x**2 instead of 3x^2

# Bokijonov Mukhsinjon
# 52336
# Task 4 
# 27 points

```


```python
from sympy.abc import x
```


```python
def Polynomial():
    print("Welcome to the polynomial calculator.")
    # Accept user input as Polynomial
    # Note: Please enter the valuse as 3*x**2 instead of 3x^2

    input1 = sym.Poly(input("Please enter the first Polynomial: "))
    input2 = sym.Poly(input("Please enter the second Polynomial: "))
    p1= input1
    p2 = input2

    # Accept operation type
    user_input = input("Please, choose Operation (+, -, *, /): ")
    # Print the result
    if user_input == '+':
        print("Result = ")
        display(Math('(%s) + (%s) =%s'%(sym.latex(p1),sym.latex(p2),sym.latex(p1 + p2))))
    elif user_input == '-':
        print("Result = ")
        display(Math('(%s) - (%s) =%s'%(sym.latex(p1),sym.latex(p2),sym.latex(p1 - p2))))
    elif user_input == '*':
        print("Result = ")
        display(Math('(%s) * (%s) =%s'%(sym.latex(p1),sym.latex(p2),sym.latex(p1 * p2))))
    elif user_input == '/':
        print("Result = ")
        display(Math('(%s) / (%s) =%s'%(sym.latex(p1),sym.latex(p2),sym.latex(p1 / p2))))
    else:
        print("Unsuppoerted operator. Restart the code! ")
        Polynomial()
    


```


```python
def Repeat():
    repeat = input("Choose: n to enter new arguments, x to exit: ")
    if repeat == 'n'.lower():
        return Polynomial()
    elif repeat  == 'x':
        print("Bye!")
        

    
```


```python
while True:
    Polynomial()
    Repeat()
    break
    
    
    
```

    Welcome to the polynomial calculator.
    Please enter the first Polynomial: x**2
    Please enter the second Polynomial: x**2
    Please, choose Operation (+, -, *, /): +
    Result = 



$\displaystyle (\operatorname{Poly}{\left( x^{2}, x, domain=\mathbb{Z} \right)}) + (\operatorname{Poly}{\left( x^{2}, x, domain=\mathbb{Z} \right)}) =\operatorname{Poly}{\left( 2 x^{2}, x, domain=\mathbb{Z} \right)}$


    Choose: n to enter new arguments, x to exit: n
    Welcome to the polynomial calculator.



```python

```

158e6ea4924621a8e535928798adc90d9a4bedb4
ipynb
Jupyter Notebook
Polynomial_calculator.ipynb
BokijonovM/Projects
7c032f872aaa4bdf0fba100385019c6058c3c8fb
BSD-2-Clause
2021-03-18T08:12:15.000Z
2021-03-18T08:12:15.000Z
Polynomial_calculator.ipynb
BokijonovM/Python_Projects
7c032f872aaa4bdf0fba100385019c6058c3c8fb
BSD-2-Clause
Polynomial_calculator.ipynb
BokijonovM/Python_Projects
7c032f872aaa4bdf0fba100385019c6058c3c8fb
BSD-2-Clause
Qwen/Qwen-72B
1. YES
2. YES