-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculator.py
61 lines (51 loc) · 1.68 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
####### Calculator #######
#Developer : Akhil S Kumar
#Date Created : 9/06/2019
#https://www.github.com/akhil-s-kumar
print("Hello friend, Can you introduce your name please? ")
name=input()
print('Hello', name, 'Tell me the operation you want to do?')
cont = "y" or "Y"
while cont.lower() == "y" or cont.upper() == "Y":
print("For addition press 1")
print("For differnce press 2")
print("For product press 3")
print("For Division press 4")
print("For power press 5")
print("For remainder press 6")
n=int(input("Enter your option: "))
if n is 1:
x=float(input("Enter the first number: "))
y=float(input("Enter the second number: "))
z=x+y
print("The sum of the number is {0}".format(z))
elif n is 2:
x=float(input("Enter the first number: "))
y=float(input("Enter the second number: "))
z=x-y
print("The difference of the number is {0}".format(z))
elif n is 3:
x=float(input("Enter the first number: "))
y=float(input("Enter the second number: "))
z=x*y
print("The product of the number is {0}".format(z))
elif n is 4:
x=float(input("Enter the first number: "))
y=float(input("Enter the second number: "))
z=x/y
print("The division of the number is {0}".format(z))
elif n is 5:
x=float(input("Enter the base number: "))
y=float(input("Enter the power number: "))
z=x**y
print("The power of the number is {0}".format(z))
elif n is 6:
x=float(input("Enter the divident: "))
y=float(input("Enter the divisor: "))
z=x%y
print("The remainder of the number is {0}".format(z))
else:
print("Press the correct operant")
cont = input("Do you want to continue? (y/n)")
if cont == "n":
break