-
Notifications
You must be signed in to change notification settings - Fork 5
/
sagnik-calculator.py
46 lines (31 loc) · 1.05 KB
/
sagnik-calculator.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
45
46
print("hey sagnik, i, sagnikmitrablogs, added this line")
# The definition of addition function
def add(num1, num2):
return num1 + num2
# The definition of the Substraction fucntuion
def substract(num1, num2):
return num1 - num2
# The deficintion of the multiply ficntion
def multiply(num1, num2):
return num1 * num2
# the definiton of the divied efuicntion
def divide(num1, num2):
return num1 / num2
# the definiton fgo the modulo fuicntion
def modulo(num1, num2):
return num1 % num2
print("Calculator")
print("Write 1 for Addition, 2 for Substraction, 3 for Multiplication, 4 for Division, 5 for Modulo")
choice = int(input("Enter your choice"))
first_num = float(input("Enter the First Number"))
second_num = float(input("Enter teh second Nmber"))
if(choice == 1):
print(add(first_num, second_num))
if(choice == 2):
print(substract(first_num, second_num))
if(choice == 3):
print(multiply(first_num, second_num))
if(choice == 4):
print(divide(first_num, second_num))
if(choice == 5):
print(modulo(first_num, second_num))