How to remove/delete every n-th element from list?
Let's say you have the list:
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
If you want to remove every k-th element you can do something like
del a[k-1::k]
For example with k = 3
, the current list is now
[1, 2, 4, 5, 7, 8, 10]
The output is correct, you are removing the the elements with index 0, n, 2n, ... . So 1 and 3 are removed, 2 and 4 are left. So if you want to print the 0, n, 2n, ... element, just write
print(mylist[::n])