[Tutor] Understanding code line

Gary gwengstrom at yahoo.com
Fri Mar 21 18:14:22 CET 2014


Pythonists

I am trying to understand the difference between

a = b
b = a + b
 and

a,b = b, a+ b
When used in my Fibonacci code the former generates 0,1,2,4,8,16,32 and the later
Generates 0,1,1,2,3,5,8,13,21,34,55,89.  The second is the sequence I want, but I would
Like to understand the second code sequence better so I can write the code in R and Scilab as well as python.
G



More information about the Tutor mailing list