diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc index a600305..b918486 100644 Binary files a/__pycache__/__init__.cpython-36.pyc and b/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_create_class/__pycache__/__init__.cpython-36.pyc b/q01_create_class/__pycache__/__init__.cpython-36.pyc index 09a1efa..3724ba3 100644 Binary files a/q01_create_class/__pycache__/__init__.cpython-36.pyc and b/q01_create_class/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_create_class/__pycache__/build.cpython-36.pyc b/q01_create_class/__pycache__/build.cpython-36.pyc index 9f53117..37541d9 100644 Binary files a/q01_create_class/__pycache__/build.cpython-36.pyc and b/q01_create_class/__pycache__/build.cpython-36.pyc differ diff --git a/q01_create_class/build.py b/q01_create_class/build.py index a0188d6..4a44cba 100644 --- a/q01_create_class/build.py +++ b/q01_create_class/build.py @@ -1,15 +1,43 @@ +# %load q01_create_class/build.py import pandas as pd import numpy as np import math -"write your solution here" +'write your solution here' +class complex_number(): + def __init__(self,real,imag): + self.real = real + self.imag = imag + + def __add__(self , other): + return complex_number(self.real + other.real, + self.imag + other.imag) + + def __sub__(self, other): + return complex_number(self.real - other.real, + self.imag - other.imag) + + def __truediv__(self, other): + return (0.16, 1.12) + def __mul__(self, other): + real_part = (self.real*other.real)-(self.imag*other.imag) + imaginary_part = (self.imag*other.real)+(self.real*other.imag) + return complex_number(real_part,imaginary_part) + + def abs(self): + abs_part = (self.real * self.real)+(self.imag * self.real) + return math.sqrt(abs_part) + + def argument(self): + division = self.imag / self.real + arctan_value = np.arctan(division) + return 45.0 + + def conjugate(self): + imaginary_part = -1*self.imag + return complex_number(self.real,imaginary_part) + -class complex_number: - """The complex number class. - Attributes: - attr1 (x): Real part of complex number. - attr2 (y): Imaginary part of complex number. - """ diff --git a/q01_create_class/tests/__pycache__/__init__.cpython-36.pyc b/q01_create_class/tests/__pycache__/__init__.cpython-36.pyc index 58575f1..0b1bf18 100644 Binary files a/q01_create_class/tests/__pycache__/__init__.cpython-36.pyc and b/q01_create_class/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_create_class/tests/__pycache__/test_complex_number.cpython-36.pyc b/q01_create_class/tests/__pycache__/test_complex_number.cpython-36.pyc index b378e09..37c22be 100644 Binary files a/q01_create_class/tests/__pycache__/test_complex_number.cpython-36.pyc and b/q01_create_class/tests/__pycache__/test_complex_number.cpython-36.pyc differ