forked from Vibs-11/MasterRepository_G9
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Aniket_2310992100.py
44 lines (33 loc) · 1.04 KB
/
Aniket_2310992100.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
print("Calculator to perform operation:: ")
print(" Select a number to perform corresponding action: ")
print(
" 1 for multiplication, 2 for division, 3 for subtraction, 4 for exponent:: "
)
def multiplication(num1, num2):
mul = num1 * num2
print("Multiplication of the two nos. is ::", mul)
def division(num1, num2):
if num2 != 0:
div = num1 / num2
print("Division of the two nos. is ::", div)
else:
print("Error: Division by zero is not allowed")
def subtraction(num1, num2):
sub = num1 - num2
print("Subtraction of the two nos. is ::", sub)
def exponent(num1, num2):
exp = num1 ** num2
print("Exponent of the two nos. is ::", exp)
Operation = int(input("Select the number from 1, 2, 3, 4 ::"))
num1 = int(input("Enter the first number::"))
num2 = int(input("Enter the Second number::"))
if (Operation == 1):
multiplication(num1, num2)
elif (Operation == 2):
division(num1, num2)
elif (Operation == 3):
subtraction(num1, num2)
elif (Operation == 4):
exponent(num1, num2)
else:
print("Invalid operation selected")