I know there are many chunky ways to do this, but I am looking for a slick pythonic way to accomplish the following. Given a list of numbers:
a = [0,1,2,3,4,
You want:
b = a[::2] # Start at first element, then every other.
and:
c = a[1::2] # Start at second element, then every other.
So now we have what we want:
>>> print(b) [0, 2, 4, 6, 8] >>> print(c) [1, 3, 5, 7, 9]