0
How to delete repeated character in string...?
6 Réponses
+ 5
"".join([ c for c in txt if txt.count(c)==1])
+ 3
set(string)
+ 2
One way to approach this:
* initialize an empty output string
* iterate the given string
* for each letter, check if it is present exactly once; if yes, append into the output string
+ 1
YOU mean daaaad to dad or dad to da?
+ 1
Mississipie to mpe
+ 1
txt = 'mississipie'
new = ''
for i in txt:
if txt.count(i) < 2:
new += i
print(new)