diff --git a/advanced_topics/decorators.ipynb b/advanced_topics/decorators.ipynb index 41d2bd944bcb6d9f6400c1ce5ca7ef6566d5aa30..a3f6dfc3efc7f2faccc5e5f558ac3fdf17112a76 100644 --- a/advanced_topics/decorators.ipynb +++ b/advanced_topics/decorators.ipynb @@ -383,11 +383,11 @@ "\n", " if n in (0, 1):\n", " print('fib({}) = {}'.format(n, n))\n", - " return 1\n", + " return n\n", "\n", " twoback = 1\n", " oneback = 1\n", - " val = 0\n", + " val = 1\n", "\n", " for _ in range(2, n):\n", "\n", diff --git a/advanced_topics/decorators.md b/advanced_topics/decorators.md index df8927bff086f29a4faf2efb3baeb50401f4d1ed..86b06335d131bad3441d8c65e03fd23cf2ba9272 100644 --- a/advanced_topics/decorators.md +++ b/advanced_topics/decorators.md @@ -292,11 +292,11 @@ def fib(n): if n in (0, 1): print('fib({}) = {}'.format(n, n)) - return 1 + return n twoback = 1 oneback = 1 - val = 0 + val = 1 for _ in range(2, n): @@ -417,13 +417,13 @@ earlier `memoize` decorator: @limitedMemoize(5) def fib(n): - if n in (1, 2): + if n in (0, 1): print('fib({}) = 1'.format(n)) - return 1 + return n twoback = 1 oneback = 1 - val = 0 + val = 1 for _ in range(2, n):