MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __str__

Method __str__

maths/radix2_fft.py:160–171  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

158
159 # Overwrite __str__ for print(); Shows A, B and A*B
160 def __str__(self):
161 a = "A = " + " + ".join(
162 f"{coef}*x^{i}" for i, coef in enumerate(self.polyA[: self.len_A])
163 )
164 b = "B = " + " + ".join(
165 f"{coef}*x^{i}" for i, coef in enumerate(self.polyB[: self.len_B])
166 )
167 c = "A*B = " + " + ".join(
168 f"{coef}*x^{i}" for i, coef in enumerate(self.product)
169 )
170
171 return f"{a}\n{b}\n{c}"
172
173
174# Unit tests

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected