a trained covered x km at 30 kmph and another 2 x km at 20 kmph . find the average speed of the train in covering the entire 3 x km .
n0 = 30.0
n1 = 2.0
n2 = 20.0
n3 = 3.0
t0 = n0 / n0
t1 = n0 * n3
t2 = n0 * n1
t3 = t2 / n2
t4 = t0 + t3
answer = t1 / t4
print(answer)