Hi i am new in python and i have a problem. I know there is a way to this this with % but i am trying to do it without the modulo if there is a way to do so. I have a list of numbers and i need to every Nth(i have every second number to keep it simple) number to be printed out, but when is reaches the maximux index it will give me an error "list is out of index". I have tried if original_position >= len(s): for j in s[0:]
but it doesnt seems to work. This is what i have come up with so far:
def napln(n):
s = []
for i in range(n):
s.append(i)
print(s)
return s
def rozpocitavadlo(s):
rozpocitavadlo = []
for i in s:
original_position = s[i]
changed_position = s[i+2]
original_position = changed_position
if original_position >= len(s):
for j in s[0:]:
original_position = s[j]
changed_position = s[j+2]
original_position = changed_position
rozpocitavadlo.append(s.pop(original_position))
s = napln(6)