Trying to create a fibonacci sequence up to "n" number, I found that the following code only doubles the last value
def fibon(n):
a=0
b=1
for i in range(n):
a=b
b=a+b
print(b)
But if done in the same line, it is able to do the correct operation
def fibon(n):
a=0
b=1
for i in range(n):
a,b=b,a+b
print(b)
I 'm just wondering why the second methods works, and whats the diference between the two. Thanks.