Difference between revisions of "Shared:Sandbox"
From CECO
Line 1: | Line 1: | ||
+ | ==Python Fibonacci numbers== | ||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
def fib(n): | def fib(n): |
Latest revision as of 17:30, 9 September 2013
Python Fibonacci numbers
def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n-1) + fib(n-2)