do we have any way to assign a function inside function itself in python? I tried to call out a nth Fibonacci as below:
memo={0:0,1:1}
def fib(n):
if n<=1:
return n
if memo[n] is None:
fib(n)=fib(n-1)+fib(n-2)
return memo[n]
print(fib(5))
fib(n)=...wouldn't be valid anywhere, inside or outsidefib. Assigning tofib(n)is not what needs to happen here.