Python Program To Print Repeated Characters In A String

Python Program To Print Repeated Characters In A String

 

01. Example

string = "zeroones.org"
repeat = []

for character in string:
   if string.count(character) > 1:
     if character not in repeat:
       repeat.append(character)

print(repeat)

Output:

['e', 'r', 'o']

 

Leave a comment