Skip to content

Instantly share code, notes, and snippets.

@phabee
Created October 4, 2020 19:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save phabee/b4b0c0c1a47855c04802c381026bae9c to your computer and use it in GitHub Desktop.
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