I want to return a list of all the indexes in a string that have capital letters. So far I am able to create a list of all the values instead of their indices with a list comprehension. E.g.
the string "HeLlO" should output [0, 2, 4]
Here's what I got:
def capital_indexes(str):
return [x for x in str if x.isupper()]
Output is ['H', 'L', 'O']