Home Segments Index Top Previous Next

612: Practice

Suppose that, incredibly, the railroad-car serial-numbering standard changes. Now the railroad name may occupy any number of characters, so you must find the type-encoding character behind the first hyphen. Also, instead of just a one-type–one-character relation, box cars are indicated by b or B, or by x or X, and tank cars are indicated by T or L or G. Modify the program in Segment 611 to accommodate the changes. Be sure to change only the extract_car_code function.