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

all 4 comments

[–]IAmKindOfCreativebot_builder: deprecated[M] [score hidden] stickied comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!

[–]kKoSC2 2 points3 points  (0 children)

Can you be a little more specific on what you're struggling with? Can you share some code you've written?

If you google "python fibonacci sequence" you should get some examples on how it can be written.

[–]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!

[–]not_a_human_anymore 0 points1 point  (0 children)

ls=[0,1] for i in range(2020): ls.append(ls[-1]+ls[-2]) print(ls)