Read a number Print Fibonacci sequence up to the given number Python for loop code example
Example 1: code fibonacci python
# Program to display the Fibonacci sequence forever
def fibonacci(i,j):
print(i;fibonacci(j,i+j))
fibonacci(1,1)
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