Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
This just contains learner python programs.
This contains executable program to generate Fibonacci series using recursive approacch .

The Fibonacci Sequence is the series of numbers:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...

The next number is found by adding up the two numbers before it:

-> the 2 is found by adding the two numbers before it (1+1),
-> the 3 is found by adding the two numbers before it (1+2),
-> the 5 is (2+3),
.... and so on!
9 changes: 5 additions & 4 deletions fibo.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Fibonacci series using recursion
def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b
if n <= 1:
return n
else:
return(fib(n-1) + fib(n-2))

def fib2(n): # return Fibonacci series up to n
result = []
Expand Down