abstracted structures fixed

This commit is contained in:
Mari Wahl 2015-01-06 21:11:21 -05:00
parent 3fdbc2a605
commit 01703751f1
98 changed files with 305 additions and 856 deletions

16
src/builtin_structures/fibonacci.py Normal file → Executable file
View file

@ -33,6 +33,22 @@ def fib(n):
return b
def fib_rec(n):
'''
>>> fib_rec(2)
1
>>> fib_rec(5)
5
>>> fib_rec(7)
13
'''
if n < 3:
return 1
return fib_rec(n - 1) + fib_rec(n - 2)
if __name__ == '__main__':
import doctest
doctest.testmod()