Skip to content

Instantly share code, notes, and snippets.

@amiiy
Created January 26, 2017 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amiiy/ad37378dad5cac71f156c701b8be53ba to your computer and use it in GitHub Desktop.
Save amiiy/ad37378dad5cac71f156c701b8be53ba to your computer and use it in GitHub Desktop.
fibonacci series with recursive approach
# recursive fibonacci series
# to mush overhead & duplicated calculation's
# let it gooo !
def fib(x):
if x == 1 or x == 2 :
return 1
else:
return fib(x-1) + fib(x - 2 )
def collect(n) :
l = []
for i in range(n):
temp = fib(i) ;
l.append(temp)
return l
print(collect(5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment