Travel 30 km at 60 km/h and return 30 km at 30 km/h. Total 60 km in 1.5 hours gives 40 km/h.

The worked example

Calculation
30 / 60 = 0.5
30 / 30 = 1
60 / 1.5 = 40

These are constructed inputs. Displayed decimals are rounded; they are not product measurements.

Understand the result before using it

The slower leg occupies twice as much time as the faster leg even though both cover the same distance. Averaging 60 and 30 gives 45 km/h, which incorrectly gives both legs equal time weight. The journey average is total distance divided by total elapsed time.

Add a 15-minute stop and the full-trip average becomes 60 divided by 1.75, about 34.29 km/h. If the task is to estimate arrival time, include that stop; if the task is moving speed, state that stops were excluded. Equal-distance and equal-time journeys produce different averages. This calculation explains a record or plan and is not a reason to increase speed to compensate for a delay.

The boundary of this calculation

Stops and delays must be added to time if measuring the full journey. Do not use this as a driving target.

Inspect the example inputs and run the Python checks. They use only the published examples and do not read personal folders.