This method receives lists of String as parameters and is supposed to return all Strings in uncheckeds that do not have a match in valids. (The Strings are e-mail addresses)
If I input two Lists that are exactly the same, some of the duplicates are found, but not all of them. This behaviour is consistent if i input two unique Lists. Some duplicates are found and removed, some are not.
I have found similar questions answered, but i cant find information regarding this specific problem.
My method:
def getUnmatchedAddresses(valids, uncheckeds):
unmatcheds = uncheckeds
for unchecked in uncheckeds:
for valid in valids:
if(unchecked == valid):
unmatcheds.remove(valid)
return unmatcheds