x = [1, 2, 3, 4, 5]
y = [2, 4]
def remove_duplicados(l1, l2):
return (i for i in l1 if i not in l2)
z = remove_duplicados(x, y)
# Alteração em y:
y.append(3)
print(type(z)) # <class 'generator'>
# Saída de z modificada devido alteração em y:
print(list(z)) # [1, 5]
eCA9IFsxLCAyLCAzLCA0LCA1XQp5ID0gWzIsIDRdCgpkZWYgcmVtb3ZlX2R1cGxpY2Fkb3MobDEsIGwyKToKICAgIHJldHVybiAoaSBmb3IgaSBpbiBsMSBpZiBpIG5vdCBpbiBsMikKCnogPSByZW1vdmVfZHVwbGljYWRvcyh4LCB5KQoKIyBBbHRlcmHDp8OjbyBlbSB5Ogp5LmFwcGVuZCgzKQoKcHJpbnQodHlwZSh6KSkgICMgPGNsYXNzICdnZW5lcmF0b3InPgoKIyBTYcOtZGEgZGUgeiBtb2RpZmljYWRhIGRldmlkbyBhbHRlcmHDp8OjbyBlbSB5OgpwcmludChsaXN0KHopKSAgIyBbMSwgNV0=