+ 6

Repeating charachters

How can a function that takes one argument and only accept characters between a-z and remove any duplicates in the string be put in code form in Python. It should return a tuple with two variables 1. A new string with uniquely sorted characters. 2. The total number of duplicates dropped. e.g., rem_duplicate ('aabbac') => ('abc', 3) rem_duplicate ('a') => ('a', 0) rem_duplicate ('theleash')=>('aehlst', 2)

30th Jun 2017, 11:05 AM
Krafty Coder
Krafty Coder - avatar
5 Réponses
+ 5
Already corrected the mistake
30th Jun 2017, 12:06 PM
Krafty Coder
Krafty Coder - avatar
+ 1
these examples are wrong
30th Jun 2017, 11:20 AM
Mohamed Mohamedy
Mohamed Mohamedy - avatar
+ 1
use a list to count the numbers of each alphabet
30th Jun 2017, 11:23 AM
Flandre Scarlet
Flandre Scarlet - avatar
+ 1
This doesn't check for a-z range: https://code.sololearn.com/c4ehY66V1upT/?ref=app
30th Jun 2017, 1:40 PM
Igor B
Igor B - avatar
+ 1
https://code.sololearn.com/cMCzwF9TMzoE
20th Dec 2017, 5:24 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar