Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Hi, actually, function 1 is called when python interpret the line that contain @function1. So it call it like this: function1(function2). This is redefining the function2 to what function1 returns.
If function1 return function2, later calls to function2 will indeed execute the code of function 2.
In the case of this solution, as memoized function is returning the wrapped function, later calls to fibonacci actually will call wrapped function (that has inside it the original fibonacci function).
So, when the interpreter reads the line "@memoized", it calls the memoized function (like this memoized(fibonnacci) ). Then it creates the empty dictionary and return the wrapper function. This way the dictionary is not redefined to empty at every call to fibonacci function.
The dictionary is still saved at the memory and the wrapper function has a reference to it.
Later call to fibonacci function will indeed call the wrapper function because the memoized functoin redefined it to wrapper function.
Hey guy, maibe you need to study some math too, before some exercises. To rank up you will need basic math generally that basics that is need to start to study computer science.
I would recomend you to go to https://khanacademy.org/ and start learning the basics meanwhile you study how to program.
Just trying to help.