Looking for something else?

Not the answer you are looking for? Search for more explanations.

## More answers

Looking for something else?

Not the answer you are looking for? Search for more explanations.

- anonymous

fibonacci sequence....i found this code and it really worked but i don't understand how code was excuted. Thank

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your **free** account and access **expert** answers to this

and **thousands** of other questions.

Get your **free** account and access **expert** answers to this and **thousands** of other questions

- anonymous

- schrodinger

See more answers at brainly.com

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your **free** account and access **expert** answers to this

and **thousands** of other questions

- anonymous

- anonymous

- anonymous

I couldn't open your attachments, but there is an example on this page of how to calculate Fibonacci sequences:
http://en.wikibooks.org/wiki/Python_Programming/Loops

Looking for something else?

Not the answer you are looking for? Search for more explanations.

- anonymous

This is the one i couldn't understand. Can you explain to me the idea please. Thanks

- anonymous

A Fibonnaci sequence is where a number is the sum of the previous two numbers in the sequence (the sequence begins 0, 1). This code gives the first 20 Fibonnaci numbers. So each number is the sum of the previous two. The last three numbers are 1597 2584 4181.
1597 + 2584 = 4181

- anonymous

I can't understand old_a and old_b issues

- anonymous

Those are variables that allow you to keep track of the previous two numbers in the sequence. Try printing out the code and writing in the values as you go along.

- anonymous

sammi789 is a spammer and i would bet her website doesn't specifically cater to the MIT OCW class like this one does.

- anonymous

a = 0
b = 1
count = 0
max_count = 20
while count < max_count:
count = count + 1
#we need to keep track of a since we change it
old_a = a
old_b = b
a = old_b
b = old_a + old_b
#Notice that the , at the end of a print statement keeps it
# from switching to a new line
print (old_a,)
print()
so this is the code u worked out right
note that Fibonacci number is sum of previous two numbers in the sequence..
ex: if 0,1 are the first two numbers in sequence then the next fibonacci number will be
1(i.e..0+1)
so by the above code here two numbers in the sequence are initialized i.e a=0,b=1
here this code prints 20 numbers in fibonacci sequence..
so max_count is initialized as 20.
in order to print from beginning a while loop is used.
and it is incremented to print next numbers..
old_a,old_b are used to swap these numbers..
U JUST TRY THE COMPUTER EXECUTION ON A PAPER then u can understand how this code is working...

Looking for something else?

Not the answer you are looking for? Search for more explanations.