-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSci_cal.py
73 lines (73 loc) · 2.46 KB
/
Sci_cal.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
62
63
64
65
66
67
68
69
70
71
72
73
import math
print("AC | ( | ) | CE |")
print("------------------")
print("Pi | e |phi|tau |")
print("------------------")
print("Inv |sin|cos|tan |")
print("------------------")
print("log |ln | ! |RtoD|")
print("------------------")
print("root|sq.|cu.| ^ |")
print("------------------")
print(" / | - | + | * |")
print("------------------")
print("rnd | . |exp|gcd |")
print("------------------")
print(" ans | = |")
print("------------------")
operation= input("Enter the operation you want to perform: ")
sym=operation
trignometry=["sin","cos","tan"]
logarithm=["log","ln","RtoD"]
raised=["root","sq.","cu.","^"]
extras=["/","-","+","*","rnd","exp","gcd"]
if operation in trignometry:
valuen=int(input("Enter the number: "))
x=math.radians(valuen)
if sym == "sin":
sin = math.sin(x)
print("sin of ",x," is ",sin)
elif sym == "cos":
cos = math.cos(x)
print("cos of ",x," is ",cos)
else:
tan = math.tan(x)
print("tan of ",x," is ",tan)
elif operation in logarithm:
valuen=int(input("Enter the number: "))
if sym == "log":
print("Log of ",valuen," is ",math.log10(valuen))
elif sym == "ln":
base=input("Enter the base of ",valuen," : ")
print("Log of ",valuen," is ",math.log(valuen,basee))
elif sym == "RtoD":
print("Radians ",valuen," to Degrees: ",math.degrees(valuen))
elif operation in raised:
valuen=int(input("Enter the number: "))
if sym == "root":
print("Square root of ",valuen," is ",math.sqrt(valuen))
elif sym == "sq.":
print("Square of ",valuen," is ",math.pow(valuen,2))
elif sym == "cu.":
print("Cube of ",valuen," is ",math.pow(valuen,3))
elif sym == "^":
y=int(input("Enter the ",valuen," has to be raised to: "))
print("Cube of ",valuen," is ",math.pow(valuen,y))
elif operation in extras:
no1=int(input("Enter first numbers: "))
no2=int(input("Enter second numbers: "))
if sym == "/":
dev=no1/no2
print(no1,"/",no2,":",dev)
elif sym == "-":
dif=no1-no2
print(no1,"-",no2,":",dif)
elif sym == "+":
print(no1,"+",no2,":",no1+no2)
elif sym == "*":
print(no1,"x",no2,":",no1*no2)
elif sym == "rnd":
random=[0,1]
print(f"Result for list 1 using \"any\": \"{any(random)}\"")
elif sym == "gcd":
print(no1," and ",no2,":",math.gcd(no1,no2))