Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

can someone explain to me this python code. This is a code for Fibonacci sequence while b < 50: print(b) a, b = b, a + b

OpenStudy (anonymous):

a, b = 0, 1

OpenStudy (anonymous):

I have a link you can check out that might help you try this link it explains about Fibonacci sequence http://www.youtube.com/watch?v=Dq7ORUWwSMg&feature=c4-overview-vl&list=PL41C4760954570944

OpenStudy (e.mccormick):

Python has the ability to do multiple assignment. It also fully evaluates the right hand side of the = before doing multiple assignment. Therefore, the swap function in Python is very easy: a,b=b,a This is what allows the a, b = b, a + b part of that code to work. The right hand side of b, a + b is evaluated fully and stored. Then a, b is changed to point at the new values, and the old values having nothing pointing at them go by-by.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!