Halcyon Abraham Ramirez · June 27, 2015  So this is the Fibonacci sequence.I hope bucky or someone could explain this because its really odda = b``def fib(n):     a, b = 0, 1     while b < n:         print(b)    a, b = b, a+b    fib(4)    ``this outputs:``0112``now if we tried doing this:``def fib(n):     a, b = 0, 1     while b < n:         print(b)    a = b b = a+b    fib(4)``this outputs:``01``I mean doesnt:``a,b = b,a+bjust equate to?a = bb = a+b``can someone please explain?

## Replies

 RIAS GREMORY · June 30, 2015 Thanks man i appreciate that. RIAS GREMORY · June 30, 2015 I just thought that it was simple math,In the first case the computer took 4 possibilities i.e. (0,0),(0,1),(1,0)and (1,1).while in the second case when it took 0 or 1  it ended up in only two possibilities because of condition. Halcyon Abraham Ramirez · June 30, 2015 tbh. Im not really good in math XD thats why i didn't ge it. but i do now  a lil bit I guess RIAS GREMORY · June 30, 2015 try putting the value '1' in both the equations, the first equation satisfies and gives Fibonacci series but the second one doesn't satisfy it.Just like maths. Halcyon Abraham Ramirez · June 30, 2015 yeah.but what was confusing was``a,b = b , a+bis just the same asa = bb = a + bhowever during that multiple assignment in the fibonacci scriptthe output was altered.``if your interested here is a better explaination here  http://stackoverflow.com/questions/31118687/shorthand-code-and-fibonnaci-sequence
• 1

## Python

129,961 followers