Skip to content

Instantly share code, notes, and snippets.

@DeviaVir
Created April 16, 2017 21:54
Show Gist options
  • Save DeviaVir/706fa8b75adfd0d0b3f016332c6a1d2e to your computer and use it in GitHub Desktop.
Save DeviaVir/706fa8b75adfd0d0b3f016332c6a1d2e to your computer and use it in GitHub Desktop.
def fib():
a, b = 0, 1
while True:
yield a
a, b = b, a + b
def main(i=0):
if i is 0:
return 0
f = fib()
for s in range(0, i + 1):
if s == i:
return next(f)
else:
next(f)
while True:
try:
i = raw_input()
if i:
print main(int(i))
except:
"""Stop."""
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment