"Enter The First Number: " "Enter The Second Number: " "Addition:" "Subtraction:" "Multiplication:" "Division:" "Floor Division:" "Modulo:"
"Enter The First Number: " "Enter The Second Number: " "Addition:" "Subtraction:" "Multiplication:" "Division:" "Floor Division:" "Modulo:"
1.Write a Python program that takes two numbers (integer or floating- point) as input from the user and
performs the following operations: addition, subtraction, multiplication, division, floor division, and modulo.
Display the results of each operation.
In [2]:
In [3]:
expression1 = 5 + 5 * 5
expression2 = (5 + 5) * 5
if expression1 == expression2:
print("The expressions are equal.")
else:
print("The expressions are not equal.")
3.29/8+(5*2) +3=?
In [4]:
Result: 16.625
localhost:8888/notebooks/2140201.ipynb 1/2
11/07/2023, 10:22 2140201 - Jupyter Notebook
4.Solve x^2 + 2x + 1
In [5]:
import cmath
a = 1
b = 2
c = 1
discriminant = (b**2) - (4*a*c)
solution1 = (-b - cmath.sqrt(discriminant)) / (2*a)
solution2 = (-b + cmath.sqrt(discriminant)) / (2*a)
print("Solution 1:", solution1)
print("Solution 2:", solution2)
Solution 1: (-1+0j)
Solution 2: (-1+0j)
In [6]:
Enter an integer: 10
Multiplication Table for 10
10 x 1 = 10
10 x 2 = 20
10 x 3 = 30
10 x 4 = 40
10 x 5 = 50
10 x 6 = 60
10 x 7 = 70
10 x 8 = 80
10 x 9 = 90
10 x 10 = 100
localhost:8888/notebooks/2140201.ipynb 2/2