Skip to content

Instantly share code, notes, and snippets.

@edenau
Created February 23, 2020 23:42
Show Gist options
  • Save edenau/ebeaf8e068b17cd7a624b9d843db3bd3 to your computer and use it in GitHub Desktop.
Save edenau/ebeaf8e068b17cd7a624b9d843db3bd3 to your computer and use it in GitHub Desktop.
def fibo(n):
assert n >= 0 and int(n) == n, 'Fibonacci number is defined for non-negative indices only!'
if n in [0,1]:
return n
else:
return fibo(n-1) + fibo(n-2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment