Currently, I want to remove a value that is being looped through if it exists in both lists, as such:
for value in Word1:
if value in Word2:
Word1.remove(value)
Word2.remove(value)
However, this code is returning ['a', 'b', 'b']
for the Word1: ['a', 'a', 'a', 'b', 'b', 'b']
and Word2: ['a', 'a', 'b', 'b']
when I would expect it to return ['a', 'b']
. What is causing this issue? Pythontutor's visualisation doesn't seem to be helping me.