Aug-23-2023, 02:52 AM
Quote: I searched the net and read some pages but I did not understand how to correct the code.“TypeError: 'nonetype' object is not callable” occurs when you try to call a None value as if it were a function. To solve it, make sure that you do not override the names of any functions with a None value.
I googled "TypeError: 'NoneType' object is not callable" and this was the very first hit.
https://www.geeksveda.com/typeerror-none...-callable/
This is exactly what you did here.
def memorize(func): cash={} def wrapper(*args): if args in cash: return cash[args] else: result=func(*args) cash[atgs]=result return result return wrapper # <-- Indentation errorBecause of the indentation error, calling memorize(sum_of_odd_numbers) returns None when you wanted it to return sum_ov_numbers.wrapper. This means when you called sum_of_odd_numbers(10) you ended up calling None(10).