Adding arithmetic version

parent 9f519731
......@@ -13,6 +13,8 @@ class ComplexNumber:
return "({0},{1})".format(comp.x,comp.y)
def __repr__(comp):
return ('str(comp.x)'" + i"'str(comp.y)')
def __add__(comp,other):
if (type(other) is ComplexNumber):
......@@ -100,6 +102,9 @@ def conj(comp):
else:
return comp
def mysquare(comp):
return comp**2
def mag(comp):
return (comp.x**2+comp.y**2)**(0.5)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment