0

How to delete repeated character in string...?

Python

29th Sep 2022, 11:57 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
6 Respostas
+ 5
"".join([ c for c in txt if txt.count(c)==1])
1st Oct 2022, 7:50 AM
Oma Falk
Oma Falk - avatar
+ 3
set(string)
29th Sep 2022, 2:07 PM
SoloProg
SoloProg - avatar
+ 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
30th Sep 2022, 12:57 PM
Lisa
Lisa - avatar
+ 1
YOU mean daaaad to dad or dad to da?
29th Sep 2022, 1:27 PM
Oma Falk
Oma Falk - avatar
+ 1
Mississipie to mpe
30th Sep 2022, 6:44 AM
chandrakanth karamthod
chandrakanth karamthod - avatar
+ 1
txt = 'mississipie' new = '' for i in txt: if txt.count(i) < 2: new += i print(new)
1st Oct 2022, 4:19 AM
Harsha S
Harsha S - avatar