I'm trying to solve a challenge that I found online. It gives an input word and the expected output is a list of the indexes of all the capital letters. My program works unless there's duplicate capital letters. I can't figure out how to deal with it. Here's my code right now:
def capital_indexes(string):
string = list(string)
print(string)
output = []
for i in string:
if i.isupper():
output.append(string. index(i))
return output
Like I said, it works for words like "HeLlO" but not for words like "TesT"