Advertisement
Dido09

Python - return the index of each capital letter

Feb 1st, 2022
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.16 KB | None | 0 0
  1. def capital_indexes(test_str):
  2. res = [idx for idx in range(len(test_str)) if test_str[idx].isupper()]
  3. return str(res)
  4.  
  5. print(capital_indexes('HI'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement