vendredi 27 juillet 2018

y=[ x[i] for i in range(len(x)) if not x[i] in x[:i] ]

y=[ x[i] for i in range(len(x)) if not x[i] in x[:i] ]

Can anyone explain to me how this step by step approach to deleting duplicates and sorting in ascending order both works at the same time in this single line?Thanks.

Aucun commentaire:

Enregistrer un commentaire