Write a program to calculate and print the Fibonacci sequence using a for loop withoute classes or functions. , the sequence goes 0, 1, 1, 2, 3, 5, 8, 13, 21 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