May-10-2019, 10:47 AM
(May-10-2019, 10:39 AM)mcgrim Wrote: (and the imag) so what differs between one method and the other is the return value, which for what I need, must exclusively return a (or b depending on the method).
yes and I gave you example for that :-) here it is again
class Complex(): def __init__(self, real, imag): self.real = real self.imag = imag c = Complex(1, 2) print(c.real) print(c.imag)
Output:1
2
>>>
for the second partYou understand that your method will always return None, right? There is no explicit return, so by default it will return None.
Then read this https://docs.python.org/3.7/library/stdtypes.html#truth
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs