Python ProgrammingPython Programming

How to find all positions of the maximum value in a list?

thelist = [5, 2, 4, 9, 7, 2, 9]

max_value = max(thelist)
max_indexes = [i for i, j in enumerate(thelist) if j == max_value]
print(max_indexes)
Output
[3, 6]