Skip to content

Commit ec41dc9

Browse files
author
codehouseindia
authored
Merge pull request codehouseindia#319 from Devesh-code/patch-1
Added Fibonacci Series in Python
2 parents cd0f6ba + 9b24bcc commit ec41dc9

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Fibonacci Series in Python

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# https://www.facebook.com/permalink.php?story_fbid=2675366319446169&id=100009184817938
2+
# Subscibed by Devesh Sharma
3+
# Function for nth Fibonacci number
4+
5+
def Fibonacci(n):
6+
if n<=0:
7+
print("Incorrect input")
8+
# First Fibonacci number is 0
9+
elif n==1:
10+
return 0
11+
# Second Fibonacci number is 1
12+
elif n==2:
13+
return 1
14+
else:
15+
return Fibonacci(n-1)+Fibonacci(n-2)
16+
17+
# Driver Program
18+
19+
print(Fibonacci(9))
20+
21+
#This code is contributed by Devesh Sharma

0 commit comments

Comments
 (0)