Skip to content

Instantly share code, notes, and snippets.

@att288
Last active May 19, 2019 01:48
Show Gist options
  • Save att288/f536e88940ab20d1cd2220db63f1efc0 to your computer and use it in GitHub Desktop.
Save att288/f536e88940ab20d1cd2220db63f1efc0 to your computer and use it in GitHub Desktop.
def fib(n):
if n == 0:
return 0
if n == 1:
return 1
fn_2 = 0
fn_1 = 1
for i in range(n-1):
fn = fn_1 + fn_2
fn_2 = fn_1
fn_1 = fn
return fn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment