Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def fibonacci(n):
if n >= 2:
return fibonacci(n - 2) + fibonacci(n - 1)
elif n == 2:
return 1
elif n == 1:
return 1
else:
return 0
from pytictoc import TicToc
t = TicToc()
t.tic()
a = fibonacci(30)
t.toc()
print(a)
@phabee
Copy link
Author

phabee commented Oct 4, 2020

Simple fibonacci experiment with python to calculate n-th fibonacci number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment