I want to make a function that will remove '-' from two sequences of char if both contain it. This is my code.
def normalized(seq1, seq2):
x = ''
y = ''
for a, b in zip(seq1, seq2):
if a != '-' and b != '-':
print a,b, 'add'
x += a
y += b
else:
print a, b, 'remove'
return x,y
x = 'ab--dfd--df'
y = 'rt-bfdsu-vf'
print normalized(x, y)
and this is the result.
a r add
b t add
- - remove
- b remove
d f add
f d add
d s add
**- u remove**
- - remove
d v add
f f add
('abdfddf', 'rtfdsvf')
You can see that - and u should not be removed. What's wrong with my code?
- bshould be removed?