If you have a list with repeated elements, as below, how do you get the indices for each occurrence of that element?
Here's my example.
'''
listy = ["apples", "oranges", "apples", "bananas", "apples", "bananas"]
print (listy.index("bananas"))
'''
You can see it only will yield one result - 3, which is correct, but it is only one of the banana elements in the list.
What if you wanted to find the indices of all the others for any of the elements? Is there a way to do it?