Remove_duplicates function (in Python) challenge. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Remove_duplicates function (in Python) challenge.

Write a function called remove_duplicates which will take one argument called string. This string input will only have characters between a-z. The function should remove all repeated characters in the string and return a tuple with two values: A new string with only unique, sorted characters. The total number of duplicates dropped. For example: remove_duplicates('aaabbbac') => ('abc', 5) remove_duplicates('a') => ('a', 0) remove_duplicates('thelexash') => ('aehlstx', 2)

10th Apr 2017, 1:48 PM
Obongekeme Udo
Obongekeme Udo - avatar
4 Answers
10th Apr 2017, 2:11 PM
Tob - avatar
+ 2
10th Apr 2017, 2:17 PM
Eranga - avatar
@Tobi you are very correct
10th Apr 2017, 3:22 PM
Obongekeme Udo
Obongekeme Udo - avatar
11th Apr 2017, 4:53 PM
Klaus-Dieter Warzecha
Klaus-Dieter Warzecha - avatar