Dear members I have a query, I understand the concept from the below :
https://stackoverflow.com/a/21990958/22419694 Python a, b = b, a +b
but what if we code the program this way ?
n=int(input("Enter a number"))
def fibo(n):
b=1
a=0
for i in range (n+1):
print(a)
b=a+b # b =0+1 ( a is not yet initialized to 1)which makes b=1
a=b # and then b is initialized with 'a' as per my logic so, a=1
print(fibo(n))
Please help
I am trying to execute Fibonacci series but still I fail to get the desired result i.e Fibonacci series for n=5 0,1,1,2,3,5... instead the result is = 0,1,2,4,8