I have two sequences that I want to put into a list of (x, y) coordinates.
seq1 = "11-345"
seq2 = "122--5"
I want to remove any (x, y) pair that contains a '-' so I wrote a simple for loop, but it doesn't remove all of the pairs. If there are multiple '-'s next to each other, some are not removed.
z = zip(seq1, seq2)
for (x, y) in z:
if x == '-' or y == '-':
z.remove((x, y))
In this example, it gives me z = [('1', '1'), ('1', '2'), ('3', '-'), ('5', '5')]
Sometimes only the first is removed, sometimes the last, depending on the sequence. Any ideas as to why or how to fix this?