What are some alternative ways to find all positions of the maximum value in a list in Python?

I have a list of numbers and I need to find all the positions of the maximum value in the list. I have already tried using the max() and index() methods to find the index of the maximum value, but that only gives me the position of the first occurrence of the maximum value.

Here’s the code I’ve tried so far:

In this code, I define a list my_list with six elements. I then use the max() method to find the maximum value in the list, and the index() method to find the index of the first occurrence of the maximum value. When I print the max_index variable, I only get the position of the first occurrence of the maximum value (which is index 1).

Could someone please suggest some alternative methods that I can use to find all the positions of the maximum value in the list? Any help would be greatly appreciated. Thank you!