how can we remove duplicate element from the given input string using python ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 Answers
+ 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