I have the general idea of how to do this in Java, but I am learning Python and not sure how to do it.
I need to implement a function that returns a list containing
Using the for-loop like you have, one way is this:
def altElement(a): b = [] j = False for i in a: j = not j if j: b.append(i) print b
j just keeps switching between 0 and 1 to keep track of when to append an element to b.