formula fibonacci sequence python code example
Example 1: fibonacci series in python
#Recursive Solutions
def fibo(n):
if n<=1: return 1
return fibo(n-1)+fibo(n-2)
fibo(5)
#OUTPUT:
#120
Example 2: python fibonacci sequence generator
number1 = 0
print('1:', number1)
number2 = 1
for count in range(2, 101):
print(count, ':', number1 + number2)
number1 += number2
number2 = number1 - number2