MCPcopy Create free account
hub / github.com/CodeWithHarry/The-Ultimate-Python-Course / __mul__

Method __mul__

Chapter 11 - PS/04_problem4.py:9–12  ·  view source on GitHub ↗
(self, c2)

Source from the content-addressed store, hash-verified

7 return Complex(self.r + c2.r, self.i + c2.i)
8
9 def __mul__(self, c2):
10 real_part = self.r * c2.r - self.i * c2.i
11 imag_part = self.r * c2.i + self.i * c2.r
12 return Complex(real_part, imag_part)
13
14 def __str__(self):
15 return f"{self.r} + {self.i}i"

Callers

nothing calls this directly

Calls 1

ComplexClass · 0.85

Tested by

no test coverage detected