Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def add(self, a, b):
:param b:
:return:
"""
print( a + b)
return a + b


Expand All @@ -41,7 +40,6 @@ def subtract(self, x, y):
:param y:
:return:
"""
print( x - y)
return x - y


Expand All @@ -52,7 +50,6 @@ def multiply(self, x, y):
:param y:
:return:
"""
print( x * y)
return y * x


Expand All @@ -79,7 +76,6 @@ def square(self, base):
:param base:
:return:
"""
print( base ** 2)
return base ** 2


Expand All @@ -90,7 +86,6 @@ def exp(self, x, y):
:param y:
:return:
"""
print( x ** y)
return x ** y


Expand Down Expand Up @@ -146,8 +141,10 @@ def cosine(self, x):
:return:
"""
if self.degrees:
x = math.radians(x)
return math.cos(x)
x = math.degrees(math.cos(x))
else:
x = math.cos(x)
return x

def tangent(self, x):
"""
Expand All @@ -156,8 +153,10 @@ def tangent(self, x):
:return:
"""
if self.degrees:
x = math.radians(x)
return math.tan(x)
x = math.degrees(math.tan(x))
else:
x = math.tan(x)
return x

def inverse_sine(self, x):
"""
Expand All @@ -166,8 +165,10 @@ def inverse_sine(self, x):
:return:
"""
if self.degrees:
x = math.radians(x)
return math.asin(x)
x = math.degrees(math.asin(x))
else:
x = math.asin(x)
return x

def inverse_cosine(self, x):
"""
Expand All @@ -176,8 +177,10 @@ def inverse_cosine(self, x):
:return:
"""
if self.degrees:
x = math.radians(x)
return math.acos(x)
x = math.degrees(math.acos(x))
else:
x = math.acos(x)
return x

def inverse_tangent(self, x):
"""
Expand All @@ -186,8 +189,10 @@ def inverse_tangent(self, x):
:return:
"""
if self.degrees:
x = math.radians(x)
return math.atan(x)
x = math.degrees(math.atan(x))
else:
x = math.atan(x)
return x

##SECONDARY FORMULAS

Expand Down
50 changes: 25 additions & 25 deletions main_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,54 +121,54 @@ def screen_options():
elif Operation == 10:
print("Cosine")
if calc.degrees:
print("Enter an angle in Radians to find Cosine: ")
print("Enter an angle in degrees to find Cosine: ")
else:
print("Enter an angle in Degrees to find Cosine: ")
x = enter_num()
calc.result = calc.cosine(math.degrees(x))
return calc.result
print("Enter an angle in radians to find Cosine: ")
x = enter_num()
calc.result = calc.cosine(x)
return calc.result


elif Operation == 11:
print("Tangent")
if calc.degrees:
print("Enter an angle in Radians to find Tangent: ")
print("Enter an angle in degrees to find Tangent: ")
else:
print("Enter an angle in Degrees to find Tangent: ")
x = enter_num()
calc.result = calc.tangent(math.degrees(x))
return calc.result
print("Enter an angle in radians to find Tangent: ")
x = enter_num()
calc.result = calc.tangent(x)
return calc.result


elif Operation == 12:
print("Inverse Sine")
if calc.degrees:
print("Enter an angle in Radians to find Inverse Sine: ")
print("Enter a number to find the arc sine in degrees: ")
else:
print("Enter an angle in Degrees to find Inverse Sine: ")
x = enter_num()
result = calc.inverse_sine(math.degrees(x))
return result
print("Enter a number to find the arc sine in radians: ")
x = enter_num()
result = calc.inverse_sine(x)
return result

elif Operation == 13:
print("Inverse Cosine")
if calc.degrees:
print("Enter an angle in Radians to find Inverse Cosine: ")
print("Enter an angle in degrees to find Inverse Cosine: ")
else:
print("Enter an angle in Degrees to find Inverse Cosine: ")
x = enter_num()
calc.result = calc.inverse_cosine(math.degrees(x))
return calc.result
print("Enter an angle in radians to find Inverse Cosine: ")
x = enter_num()
calc.result = calc.inverse_cosine(x)
return calc.result

elif Operation == 14:
print("Inverse Tangent")
if calc.degrees:
print("Enter an angle in Radians to find Inverse Tangent: ")
print("Enter an angle in degrees to find Inverse Tangent: ")
else:
print("Enter an angle in Degrees to find Inverse Tangent: ")
x = enter_num()
calc.result = calc.inverse_tangent(math.degrees(x))
return calc.result
print("Enter an angle in radians to find Inverse Tangent: ")
x = enter_num()
calc.result = calc.inverse_tangent(x)
return calc.result

##MEMORY FUNCTIONS

Expand Down