如何将此 python 行代码转换为列表理解?

how to turn this python lines code into a list comprehension?

有人要求我将这些行转换为列表理解

tmaxima = []
ag_maxima = []
for i in sorted_indices:
tmaxima.append(t[i])
ag_maxima.append(a_g[i])

假设 sorted_indices 只包含整数:

tmaxima = [t[i] for i in sorted_indices]
ag_maxima = [a_g[i] for i in sorted_indices]