Codington
0 of 6 problems solved • 0%

Exercise prompt

Repair the Connection

A helper's return value must reach its caller. A standalone call can calculate a value and then lose it.

Example

def triple(n): return n * 3 def remaining(n): used = triple(n) return 40 - used print(remaining(4)) # 28

remaining saves triple's return value and uses it in the final subtraction.

Your task

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.