Feb-27-2018, 06:05 AM
Currently learning Python recursion and stuck on how to write linear-time fib function:
def goodfib(k): if k == 0: return 0, 0, 1 if k == 1: return 1, 0, 1 u = goodfib(k - 1) ### fill in one line of code here to finish the goodfib functionThis is the code the teacher gave us that we're to finish with a single line of code. The last number (1) returned in the base cases, btw, is just a measurement of the # of iterations. So you could pretend it wasn't there for all intents and purposes. Any help?