-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculatorClone1.py
More file actions
177 lines (145 loc) · 4.63 KB
/
CalculatorClone1.py
File metadata and controls
177 lines (145 loc) · 4.63 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
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
print("Hello! Good People, I am your Basic Clculator and I can do some Basic Calculations.Try me!")
print("1 degree= 0.0175 radians")
input1=int(input(" Do you Wish to Proceed, if so Text a number greater than 1"))
if input1>1:
C1='A'
C2='M'
C3='D'
C4='S'
C5='X'
C6='Y'
C7='Z'
C8='L'
C9='F'
C10='J'
C11='K'
C12='T'
C=print("Enter A if you wish to use Addition")
C=print("Enter M if you wish to use Multiplication")
C=print("Enter D if you wish to use Division")
C=print("Enter S if you wish to use Subtraction")
C=print("Enter X if you wish to use Sin Function")
C=print("Enter Y if you wish to use Cos Function")
C=print("Enter Z if you wish to use tan Function")
C=print("Enter L if you wish to use Logarithmic Function")
C=print("Enter F if you wish to use Factorial")
C=print("Enter J if you wish to use Inverse of sine Function")
C=print("Enter K if you wish to use Inverse of cos Function")
C=print("Enter T if you wish to use Inverse of tan Function")
input2=input("Enter the operator symbol given above that you want to use")
if input2 == C1:
while(True):
n=eval(input("Enter The Number of Operands"))
i=0
Sum=0
while i<n:
num =eval(input("enter the number"))
i=i+1
Sum = Sum + num
if i==n:
print(Sum)
print("Thanks for Choosing Us!")
break
if input2 == C2:
while(True):
n=eval(input("Enter The Number of Operands"))
i=0
Sum=1
while i<n:
num =eval(input("enter the number"))
i=i+1
Sum = Sum * num
if i==n:
print(Sum)
print("Thanks for Choosing Us!")
break
if input2 == C3:
num1=eval(input("Enter the numenator"))
num2=eval(input("Enter the Denominator"))
Sum=num1/num2
print(Sum)
print("Thanks for Choosing Us!")
if input2 == C4:
while(True):
n=eval(input("Enter The Number of Operands"))
i=0
Sum=0
while i<n:
num =eval(input("enter the number"))
if i==0:
num=(-(num))
i=i+1
Sum = Sum - num
else:
i=i+1
Sum= Sum - num
if i==n:
print(Sum)
print("Thanks for Choosing Us!")
break
if input2 == C5:
import math
a=eval(input("Enter the value to put inside sin function to print as Radians"))
x=print(math.sin(a))
print("Thanks for Choosing Us!")
if input2 == C6:
import math
a=eval(input("Enter the value to put inside cos function to print as Radians"))
y=print(math.cos(a))
print("Thanks for Choosing Us!")
if input2 ==C7:
import math
a=eval(input("Enter the value to put inside tan function to print as Radians"))
x=print(math.tan(a))
print("Thanks for Choosing Us!")
if input2 == C8:
X='N'
input1=input("Do you wish to use natural log,if so press N")
if input1==X:
import math
a=int(input("Enter The Number"))
print(math.log(a))
print("Thanks for Choosing Us!")
else:
import math
b=int(input("Enter a number"))
a=int(input("Enter a base"))
print(math.log(b,a))
print("Thanks for Choosing Us!")
if input2 == C9:
n=int(input("Enter the number"))
i=1
sum=1
while i<=n:
sum=sum*i
i=i+1
if i>n:
print("The value of",n,"! is",sum)
print("Thanks for Choosing Us!")
if input2== C10:
import math
b=eval(input("Enter the number from -1 to 1 to print value in Radian"))
if b<-1:
print("Invalid Number")
if b>1:
print("Invalid Number")
else:
print(math.asin(b))
print("Thanks for Choosing Us!")
if input2== C11:
import math
b=eval(input("Enter the number from -1 to 1 to print value in Radian"))
if b<-1:
print("Invalid Number")
if b>1:
print("Invalid Number")
else:
print(math.acos(b))
print("Thanks for Choosing Us!")
if input2== C12:
import math
b=int(input("Enter the number to print value in Radian"))
print(math.atan(b))
print("Thanks for Choosing Us!")
else:
print("Thanks for Choosing Us!")