=====Problem Statement=====
For this challenge, you are given two complex numbers, and you have to print the result of their addition, subtraction, multiplication, division and modulus operations. The real and imaginary precision part should be correct up to two decimal places.

=====Input Format=====
One line of input: The real and imaginary part of a number separated by a space.

=====Output Format=====
For two complex numbers C and D, the output should be in the following sequence on separate lines:
C+D
C-D
C*D
C/D
mod(C)
mod(D)

For complex numbers with non-zero real (A) and complex part (B), the output should be in the following format:
Replace the plus symbol (+) with a minus symbol (-) when B<0.
For complex numbers with a zero complex part i.e. real numbers, the output should be:
A+0.00i
For complex numbers where the real part is zero and the complex part is non-zero, the output should be:
0.00+Bi

Difficulty: EASY

Starter code:
import math

class Complex(object):
    def __init__(self, real, imaginary):
        
    def __add__(self, no):
        
    def __sub__(self, no):
        
    def __mul__(self, no):

    def __truediv__(self, no):

    def mod(self):

    def __str__(self):
        if self.imaginary == 0:
            result = "%.2f+0.00i" % (self.real)
        elif self.real == 0:
            if self.imaginary >= 0:
                result = "0.00+%.2fi" % (self.imaginary)
            else:
                result = "0.00-%.2fi" % (abs(self.imaginary))
        elif self.imaginary > 0:
            result = "%.2f+%.2fi" % (self.real, self.imaginary)
        else:
            result = "%.2f-%.2fi" % (self.real, abs(self.imaginary))
        return result

if __name__ == '__main__':
    c = map(float, input().split())
    d = map(float, input().split())
    x = Complex(*c)
    y = Complex(*d)
    print(*map(str, [x+y, x-y, x*y, x/y, x.mod(), y.mod()]), sep='\n')

Solutions:
import math

class ComplexNumber(object):

	def __init__(self, real, compl):
		self.real = real
		self.compl = compl
		pass

	def __str__(self):
		if self.compl >= 0:
			return '{0:.2f}'.format(self.real) + '+' + '{0:.2f}'.format(self.compl) + 'i'
		return '{0:.2f}'.format(self.real) + '-' + '{0:.2f}'.format(abs(self.compl)) + 'i'

	def __add__(x, y):
		return ComplexNumber(x.real + y.real, x.compl + y.compl)

	def __sub__(x, y):
		return ComplexNumber(x.real - y.real, x.compl - y.compl)

	def __mul__(x, y):
		return ComplexNumber(x.real * y.real - x.compl * y.compl, x.compl * y.real + x.real * y.compl)

	def __truediv__(x, y):
		return ComplexNumber((x.real * y.real + x.compl * y.compl) / (y.real * y.real + y.compl * y.compl), (x.compl * y.real - x.real * y.compl) / (y.real * y.real + y.compl * y.compl))

	def mod(self):
		return ComplexNumber(math.sqrt(self.real * self.real + self.compl * self.compl), 0)
help = list(map(float, input().split(' ')))
x = ComplexNumber(help[0], help[1])
help = list(map(float, input().split(' ')))
y = ComplexNumber(help[0], help[1])
print(x + y)
print(x - y)
print(x * y)
print(x / y)
print(x.mod())
print(y.mod())


import numbers
(r1, i1) = map(float, input().split())
(r2, i2) = map(float, input().split())
c1 = complex(r1, i1)
c2 = complex(r2, i2)

def printer(c):
	real = c.real
	imag = c.imag
	sign = '+' if imag >= 0 else '-'
	print('{:.2f}{}{:.2f}i'.format(real, sign, abs(imag)))

def mod(c):
	return (c.real * c.real + c.imag * c.imag) ** 0.5
printer(c1 + c2)
printer(c1 - c2)
printer(c1 * c2)
printer(c1 / c2)
print('{:.2f}+0.00i'.format(mod(c1)))
print('{:.2f}+0.00i'.format(mod(c2)))