How to remove a character from element and the corresponding character in another element in a list (Python)?
<pre><code>sample = ['A$$N','BBBC','$$AA']
</code></pre>

<p>I need to compare every element to every other element in the list. So compare sample[0] and sample[1], sample[0] and sample[2], sample[1] and sample[2].
a
If any pair in the comparison has "$", then "$" and the corresponding element needs to be eliminated. 
Eg. in </p>

<pre><code>sample[0] and sample[1]    Output1 : ['AN','BC']
sample[0] and sample[2]    Output2 : ['N', 'A']
sample[1] and sample[2]    Output3 : ['BC','AA']


for i in range(len(sample1)):
    for j in range(i + 1, len(sample1)):
        if i == "$" or j == "$":
            #Need to remove "$" and the corresponding element in the other list

   #Print the pairs
</code></pre>

<p>This may not be the most beautiful code but will do the job.</p>

<pre><code>from itertools import combinations
sample = ['A$$N','BBBC','$$AA']
output = []
for i, j in combinations(range(len(sample)), 2):
    out = ['', '']
    for pair in zip(sample[i], sample[j]):
        if '$' not in pair:
            out[0] += pair[0]
            out[1] += pair[1]
    output.append(out)
print(output)
</code></pre>

python list character pop del