On 27/09/2019 12:54, ast wrote:
HelloIs it feasible to define a recursive method in a class ? (I don't need it, it's just a trial) Here are failing codes: class Test: def fib(self, n): if n < 2: return n return fib(self, n-2) + fib(self, n-1)
Try self.fib(...) instead of fib(self, ...) both times. -- Rhodri James *-* Kynesim Ltd -- https://mail.python.org/mailman/listinfo/python-list