+ 6

How red came at last?

items = 'red, white, black, red, green, black' words = [word for word in items.split(',')] print(','.join(sorted(list(set(words)))))

3rd Oct 2019, 7:00 AM
Pradip Thoyal
Pradip Thoyal - avatar
3 odpowiedzi
+ 5
Oh thanks.
3rd Oct 2019, 7:15 AM
Pradip Thoyal
Pradip Thoyal - avatar
+ 3
Because some colors got " " (space) with them, it affected about how they got sorted and how set removed "duplicates".
3rd Oct 2019, 7:13 AM
Seb TheS
Seb TheS - avatar
0
c ta mere qui saigne
3rd Oct 2019, 7:03 AM
vincent.effantin