Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python Function Name: marta Parameters: path (str), start (str), end (str) Returns: distance (int) Description: As part of your efforts to use more public transport
python
Function Name: marta Parameters: path (str), start (str), end (str) Returns: distance (int) Description: As part of your efforts to use more public transport to reduce your carbon foot- print, you decide to take a MARTA to get around. You have a MARTA path map: a string of let- ters, each representing a stop, separated by dashes between each stop. Each dash repre- sents a mile. You also know what stop to get on the train, and which stop to get off at. Write a function that returns the distance between these stops. If the start and end stop are the same, return 0. You may assume that both stops exist in the path, and the ending stop will al- ways come after the starting stop. >>> path = "a---b-C-----d" >>> start = "b" >>> stop = "C" >>> print(marta(path, start, stop)) >>> path = "a-b-C---d--e--f" >>> start = "a" >>> stop = "f" >>> print(marta(path, start, stop))Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started