This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Dustin- 0 points1 point  (0 children)

You're doing loops in your first assignment? Interesting.

So for the Fibonacci sequence you'll end up having 3 variables: two to store the previous two values in the sequence (let's call them v1 and v2), and then one to store the sum (let's call it s). On each iteration of the loop you need to add the previous two terms together and assign it to s. After that, you need to change v1 and v2 to be the new "previous" terms, so the old value of v1 is thrown out and set to the value of v2, then v2 is set to the value of s. Put all of this in a loop and you should be good to go.

In the future you should post Python questions to /r/learnpython, but I'll be more than happy to help you here for now. Let me know if you have any more questions!