Created
April 8, 2014 08:35
-
-
Save msaisushma/10101964 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
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
@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