I have a string. The letter 'o' appears twice in the whole string, but when I try to use the index() function to locate the position where the 'o' appears, it just traverses from left to right and stops when it finds the first 'o'.
Why can't index() print all the locations of 'o'?
If possible, how can I use index() to print all the strings that meet the conditions?
a = 'HaloPython!'
print(a.index('o'))