Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 4: Planning your route Now that you've worked out a system for estimating travel distances and ride fares, you're ready to start testing your

image text in transcribed
Part 4: Planning your route Now that you've worked out a system for estimating travel distances and ride fares, you're ready to start testing your new rideshare service. You fire up your fancy new program and immediately get three simultaneous rider requests, but luckily they all are looking for a ride to the same place the airport! You plan on picking up all three passengers on the same trip so that you can drop them all off at the same time. You want to take the shortest possible route so that you minimize the cost of gas and, in turn, the amount of money the trip costs you! The challenge: You need to create a function that takes in a starting position, a list of three rider locations, and a stopping location and determines the order of rider pickups that will require the least amount of driving. You want to make the default stopping location be the airport, since you figure this is where people will be headed most often. You should be able to use your function for computing the Lyft distance to help solve this problem. Work out a plan for your function on the whiteboards first! You may need to draw a diagram to figure out how to solve this. Once you've come up with a plan, try writing the function. The function should return the list of rider locations in the appropriate pick-up order and the total distance of the trip. Let's assume that: 1. Your starting location is (-2,3) 2. The ride locations are (1, -2), (3,3), and (2 -1). 3. The stopping location, the airport, is at (4,0) :Put your code here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Master The Art Of Data Storytelling With Visualizations

Authors: Alexander N Donovan

1st Edition

B0CNMD9QRD, 979-8867864248

More Books

Students also viewed these Databases questions