-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculator.py
More file actions
40 lines (28 loc) · 1.08 KB
/
calculator.py
File metadata and controls
40 lines (28 loc) · 1.08 KB
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
import math
def add():
sum = 0
choice = int(input("Enter the number of elements you want to add:"))
for i in range(choice):
sum = sum + float(input("Enter the number:"))
return sum
def sub():
diff = 0
choice = int(
input("Enter the number of subtractions you want to perform:"))
for i in range(choice):
diff = diff - float(input("Enter the number:"))
return diff
def multiply():
product = 1
choice = int(
input("Enter the number of multiplication you want to perform:"))
for i in range(choice):
product = product * float(input("Enter the number:"))
return product
def div():
return float(input("Enter the dividend:")) / float(input("enter the divisor"))
def pow():
return float(input("Enter the base:")) ** int(input("Enter the order:"))
print("\n\n\n\n" + "*"*20 + "CALCULATOR" + "*"*20 +
"Calculations available:\n->Addition\n->Subtraction\n->Division\n->Multiplication\n->Power\n->Square Root\n->Sin(x)\n->Cos(x)\n->Tan(x)\n->cosh(x)\n->sinh(x)")
ch = input("Enter your calculation")