+ 2
How to turn a closure into a decorator
I have the feeling, decorator and closure are very similar in Python. But I don't get the transformation. Can someone transform this code to decorator please? https://code.sololearn.com/cMaHw8yzYlow/?ref=app
1 Respuesta
+ 2
My solution to your request.
The decorator (calculateScores) uses score as the wrapper function.
And put the initial values and user input in a new function initializeBoard.
Both initializeBoard and score returns a tuple storing the initial values and updated values respectively.
Values being (word, wordList, result, and initials)
Hope it helps, let me know either way.
https://code.sololearn.com/c4857v2N3KQv/?ref=app