You can sort a slice of a list, and use slice assignment to replace it in the original list:
>>> my_list = ['F', 'V', 'T', 'O', 'D', 'Q', 'I', 'P', 'M']
>>> for i in range(len(my_list) // 3):
... my_list[i*3:i*3+3] = sorted(my_list[i*3:i*3+3])
...
>>> my_list
['F', 'T', 'V', 'D', 'O', 'Q', 'I', 'M', 'P']
Another option would be to build a whole new list with sum
and just assign it to my_list
at the end (whether or not this is equivalent depends on whether there are other references to my_list
anywhere):
>>> my_list = ['F', 'V', 'T', 'O', 'D', 'Q', 'I', 'P', 'M']
>>> my_list = sum((sorted(my_list[i*3:i*3+3]) for i in range(len(my_list) // 3)), [])
>>> my_list
['F', 'T', 'V', 'D', 'O', 'Q', 'I', 'M', 'P']