In a previous article, we talked about complex numbers in Python using built-in classes and attributes to perform operations on them. But, imagine if Python didn't come equipped with these conveniences. How would we go about implementing complex operations? We can explore that concept by utilizing built-in mathematical operations to create our own complex class in Python.
To start off, we need to initialize our complex number:
def __init__ (self, real, imag=0.0):
'''Form complex number'''
...
Published on May 21, 2020 04:53