write a function get_direction(start, end) that returns the end station that is in the direction of travel between the start and end , or None if the start and end is not on the same line. use python

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter19: Probabilistic Dynamic Programming
Section19.4: Further Examples Of Probabilistic Dynamic Programming Formulations
Problem 7P
icon
Related questions
Question

write a function

get_direction(start, end) that returns the end station that is in the direction of travel between the start and end , or None if the start and end is not on the same line.

use python

Boston Subway
The Boston Subway e has four different colored trains, some of which have multiple
routes. We have simplified the routes so that each train has a single route with the
following stations (in order from north to south) and that each colored line intersects
with another colored line at exactly one station.
• Red Line: Alewife, Davis, Porter, Harvard, Central, Kendall/MIT, Charles/MGH,
Downtown Crossing, South Station, Broadway, Andrew, JFK/UMass
• Orange Line: Oak Grove, Malden Center, Wellington, Assembly, Sullivan Square,
Community College, North Station, Haymarket, State, Downtown Crossing,
Chinatown, Tufts Medical Center, Back Bay, Mass Avenue, Ruggles, Roxbury
Crossing, Jackson Square, Stony Brook, Green Street, Forest Hills
• Blue Line: Wonderland, Revere Beach, Beachmont, Suffolk Downs, Orient Heights,
Wood Island, Airport, Maverick, Aquarium, State
• Green Line: Haymarket, Government Center, Park Street, Boylston, Arlington,
Copley, Haynes Convention Center, Kenmore, Blandford Street, Boston University
East, Boston University Central, Boston University West, Saint Paul Street,
Pleasant Street, Babcock Street, Packards Corner, Harvard Avenue, Griggs Street,
Allston Street, Warren Street, Washington Street, Sutherland Road, Chiswick Road,
Chestnut Hill Avenue, South Street, Boston College
Station names must match exactly (unforgiving about upper/lowercase and
abbreviations) with the exception of names that have a "/" in them. These stations can
be referred to be either one. For example, both "Kendall" and "MIT" refer to the same
station.
Note: The simplification of our train lines is such that each line intersects with other
lines in exactly one station. But not all lines intersect every other line.
Transcribed Image Text:Boston Subway The Boston Subway e has four different colored trains, some of which have multiple routes. We have simplified the routes so that each train has a single route with the following stations (in order from north to south) and that each colored line intersects with another colored line at exactly one station. • Red Line: Alewife, Davis, Porter, Harvard, Central, Kendall/MIT, Charles/MGH, Downtown Crossing, South Station, Broadway, Andrew, JFK/UMass • Orange Line: Oak Grove, Malden Center, Wellington, Assembly, Sullivan Square, Community College, North Station, Haymarket, State, Downtown Crossing, Chinatown, Tufts Medical Center, Back Bay, Mass Avenue, Ruggles, Roxbury Crossing, Jackson Square, Stony Brook, Green Street, Forest Hills • Blue Line: Wonderland, Revere Beach, Beachmont, Suffolk Downs, Orient Heights, Wood Island, Airport, Maverick, Aquarium, State • Green Line: Haymarket, Government Center, Park Street, Boylston, Arlington, Copley, Haynes Convention Center, Kenmore, Blandford Street, Boston University East, Boston University Central, Boston University West, Saint Paul Street, Pleasant Street, Babcock Street, Packards Corner, Harvard Avenue, Griggs Street, Allston Street, Warren Street, Washington Street, Sutherland Road, Chiswick Road, Chestnut Hill Avenue, South Street, Boston College Station names must match exactly (unforgiving about upper/lowercase and abbreviations) with the exception of names that have a "/" in them. These stations can be referred to be either one. For example, both "Kendall" and "MIT" refer to the same station. Note: The simplification of our train lines is such that each line intersects with other lines in exactly one station. But not all lines intersect every other line.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr