Skip to content

Commit 49174af

Browse files
committed
Fibonnaci + Edit
1 parent 6680521 commit 49174af

7 files changed

+31
-4
lines changed
File renamed without changes.

02_FibonacciSequence.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
''' The Fibonacci sequence is a series of numbers where a number is the addition of the last two numbers,
2+
starting with 0, and 1. The Fibonacci Sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55…
3+
Written as a rule, the expression is: Xn = X(n-1) + X(n-2)
4+
5+
This program finds the nth term in the fibonacci sequence.
6+
'''
7+
def fibonnaci(n):
8+
9+
if n < 0:
10+
print("Enter Valid Input")
11+
12+
elif n == 0:
13+
return 0
14+
15+
elif n in range( 1 , 2):
16+
return 1
17+
18+
else:
19+
return fibonnaci(n - 1) + fibonnaci( n - 2)
20+
21+
print(fibonnaci(10))
22+
23+
'''
24+
By Innocent Suta
25+
26+
'''
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ These are python programs that i create to improve my problem solving skills and
55
List of Programs in this Repo
66

77
# 1 `Binary Search`
8-
# 2 `Guess a Number game`
9-
# 3 `Leap year check`
10-
# 4 `Linear Search`
11-
# 5 `Palindrome check`
8+
# 2 `Fibonacci Sequence`
9+
# 3 `Guess a Number game`
10+
# 4 `Leap year check`
11+
# 5 `Linear Search`
12+
# 6 `Palindrome check`
1213

0 commit comments

Comments
 (0)