[Tutor] (no subject)

Gary Engstrom gwengstrom at yahoo.com
Fri Mar 21 20:25:41 CET 2014


Dear Pythonists
 
Here is the code 
 
def fiba(n):
            a = 0
            b = 1
            while  a < n :
                        print(a)
                        c =  a + b
                        a = a +c
                        
     # 0,1,3,7,15,31,63
 
def fibc(n):
            a = 0
            b = 1
            while  a < n :
                        print(a)
                        a, b = b,a + b
                        
#0,1,1,2,3,5,8,13,21,34,55,89
 
def fibb(n): a + b
            a = 0
            b = 1
            while  a < n :
                        print(a)
                        a = b
                        b = a+b
            
#0,1,2,4,8,16,32,64
 
I am trying to understand function fibc code line a,b = b, a + b and would like to see it written line by line
without combining multiply assignment. If possible. I sort of follow the right to left evaluation of the other code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140321/710eebf7/attachment.html>


More information about the Tutor mailing list