Skip to content

Instantly share code, notes, and snippets.

@msaisushma
Created April 8, 2014 08:35
Show Gist options
  • Save msaisushma/10101964 to your computer and use it in GitHub Desktop.
Save msaisushma/10101964 to your computer and use it in GitHub Desktop.
def fib():
a,b,c,l,n=-1,1,0,[],int(raw_input("enter the end of series:"))
for i in range(n+1):
c=a+b
b,a=c,b
l.append(c)
n1=int(raw_input("enter the position:"))
print l[n1-1]
if __name__=='__main__':
fib()
@nandak522
Copy link

@msaisushma The only input I expect is the "nth" position. No "end of the series". For the fibanocci series: 0,1,1,2,3,5,8,13,21,34,55,89,...., input is 5, output is: 3

@nandak522
Copy link

One other usecase:

Which Fibanocci number you want to check ?: 345
345 fibanocci number is:563963353180680437428706474693749258212475354428320807161115873039415970.

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