[Tutor] Understanding code line

Joel Goldstick joel.goldstick at gmail.com
Fri Mar 21 18:21:37 CET 2014


On Mar 21, 2014 1:16 PM, "Gary" <gwengstrom at yahoo.com> wrote:
>
>
> Pythonists
>
> I am trying to understand the difference between
>
> a = b
You have overwitten a
> b = a + b
>  and
>
> a,b = b, a+ b
This one evaluates the right side first, then assigns the result to a and 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
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140321/3925bc4c/attachment.html>


More information about the Tutor mailing list