how can we remove duplicate element from the given input string using python ? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

how can we remove duplicate element from the given input string using python ?

str= " abcfghjjkkknbbbvvcccggaassdccvghhjjkknnllpkhhgvc"

10th Apr 2018, 6:43 PM
Ankit
Ankit - avatar
2 Réponses
+ 2
"".join(sorted(set(str))) remove sorted if you dont need them in alphabetical order
10th Apr 2018, 6:58 PM
Markus Kaleton
Markus Kaleton - avatar