1#Python program to generate Fibonacci series until 'n' value
2n = int(input("Enter the value of 'n': "))
3a = 0
4b = 1
5sum = 0
6count = 1
7print("Fibonacci Series: ", end = " ")
8while(count <= n):
9 print(sum, end = " ")
10 count += 1
11 a = b
12 b = sum
13 sum = a + b
14
1num = 1
2num1 = 0
3num2 = 1
4import time
5for i in range(0, 10):
6 print(num)
7 num = num1 + num2
8 num1 = num2
9 num2 = num
10 time.sleep(1)
11
1number1 = 0
2print('1:', number1)
3number2 = 1
4for count in range(2, 101):
5 print(count, ':', number1 + number2)
6 number1 += number2
7 number2 = number1 - number2
1#Learnprogramo
2Number = int(input("How many terms? "))
3# first two terms
4First_Value, Second_Value = 0, 1
5i = 0
6if Number <= 0:
7print("Please enter a positive integer")
8elif Number == 1:
9print("Fibonacci sequence upto",Number,":")
10print(First_Value)
11else:
12print("Fibonacci sequence:")
13while i < Number:
14print(First_Value)
15Next = First_Value + Second_Value
16# update values
17First_Value = Second_Value
18Second_Value = Next
19i += 1