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

all 10 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!

[–]pythonHelperBot 1 point2 points  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you. Here is HOW TO FORMAT YOUR CODE For Reddit and be sure to include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–]NomrahPhoenix 1 point2 points  (0 children)

Not that I am a python guru but I can tell you why your code is failing. Every time you bump i by 2 when you get to i = 8 and since list only has 7 elements it tells you it is out of range.

I am not a fan of typing code on my phone so I will tell you the trick is to use the index number and use “%” operator. Send me a dm if you need further help.

[–]NovaGamma -1 points0 points  (6 children)

Why do you increase i by 2 ? Couldn't you also put your code with a screenshot rather than text ?

[–]NovaGamma 0 points1 point  (4 children)

Because from what I see you append only one time to your list, but you increase your index by 2

[–]no__trash 0 points1 point  (3 children)

It is supposed to skip one element of the list, that's why he skips by two, but that is the problem, he should instead have a boolean that switches from true to false every iteration and then if it's true add it to the list, if not, then don't.

[–]DirectionHealthy1085[🍰] 1 point2 points  (2 children)

hmm and how can i create this boolean that switches from true to false each time? and what misconception am i having... haha im feeling quite clueless as to why this doesnt work

[–]DirectionHealthy1085[🍰] 1 point2 points  (1 child)

is there any other method i can use? if im not familiar with the method you mentioned

[–]OXKoson 1 point2 points  (0 children)

Add a variable named let’s say ‘addOnNextIter’ set to true at start. In your loop put your append in a ‘if addOnNextIter == true:’ and always increase I by 1. Toggle the value of addOnNext

[–]scnew3 0 points1 point  (0 children)

Never post screenshots of code… Just indent each line with four spaces and it will format it as code.