Mar-23-2018, 02:50 PM
why there is two different output for similar codes.
This below code gives proper Fibonacci
While this code does not give proper Fibonacci series
Please help me understand the execution process in python.
This below code gives proper Fibonacci
def fib(n) : a,b= 0,1 for x in range(n): print(a) a,b=b,a+bOutput: 0,1,1,2,3,5,8
While this code does not give proper Fibonacci series
def fib(n) : a,b= 0,1 for x in range(n): print(a) a=b b=a+bOutput: 0,1,2,4,8
Please help me understand the execution process in python.