In [50]:
import math
class Trig_Equations(object):
# trig functions
def __init__(self,a=1,b=1,c=1):
self.a = a
self.b = b
self.c = c
return
#methods
def hypotenuse(self):
self.c = math.sqrt(self.a**2+self.b**2)
return self.c
def change_a(self,new_a):
self.a = new_a
return
def change_b(self,new_b):
self.b = new_b
return
def change_c(self,new_c):
self.c = new_c
self.a = math.sqrt(.5)*self.c
self.b = self.a
return
pass
trig = Trig_Equations()
In [51]:
print(trig.a)
print(trig.b)
print(trig.c)
print(trig.hypotenuse())
trig.change_a(3)
trig.change_b(4)
print(trig.a)
print(trig.b)
print(trig.c)
print(trig.hypotenuse())
trig.change_c(9)
print(trig.a)
print(trig.b)
print(trig.c)
In [37]:
print(trig.change_c(5))
In [ ]: