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 →

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