Created
March 24, 2018 17:02
-
-
Save Fhernd/d5a1c15ea5828260d877a80e2396b9f0 to your computer and use it in GitHub Desktop.
Remoción de duplicados en un secuencia. OrtizOL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remover_duplicados(secuencia): | |
elementos_iterados = set() | |
for elemento in secuencia: | |
if elemento not in elementos_iterados: | |
yield elemento | |
elementos_iterados.add(elemento) | |
lista = [3, 11, 19, 3, 5, 7, 21, 5, 29] | |
print(list(remover_duplicados(lista))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment