When the same cleaning rule applies to two inputs, give it one name and use it twice.
def twice(value):
return 2 * value
def frame_length(width, height):
return twice(width) + twice(height)
print(frame_length(2, 5)) # 14Both dimensions go through the same helper. The outer function combines its two results.
Complete both functions. station_code(name) strips whitespace, takes the first three characters and uppercases them. route_code(start, end) joins two such codes with a hyphen. Short station names keep all their characters.