A helper's return value must reach its caller. A standalone call can calculate a value and then lose it.
def triple(n):
return n * 3
def remaining(n):
used = triple(n)
return 40 - used
print(remaining(4)) # 28remaining saves triple's return value and uses it in the final subtraction.
A train trip charges 4 credits per stage and a single booking fee of 2. stage_cost is correct. Repair trip_cost so it uses the stage cost and the booking fee. Even a zero-stage booking pays the fee.