Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
def get_nearest_station(my_latitude: float, my_longitude: float,
stations: List['Station']) -> int:
"""Return the id of the station from stations that is nearest to the
location given by my_latidute and my_longitude.
In the case of a tie, return the ID of the last station in stations with
that distance.
Preconditions: len(stations) > 1
» get_nearest_station(43.671134, -79.325164, SAMPLE_STATIONS)
7571
» get_nearest_station(43.674312, -79.299221, SAMPLE_STATIONS)
7486
II II ||
expand button
Transcribed Image Text:def get_nearest_station(my_latitude: float, my_longitude: float, stations: List['Station']) -> int: """Return the id of the station from stations that is nearest to the location given by my_latidute and my_longitude. In the case of a tie, return the ID of the last station in stations with that distance. Preconditions: len(stations) > 1 » get_nearest_station(43.671134, -79.325164, SAMPLE_STATIONS) 7571 » get_nearest_station(43.674312, -79.299221, SAMPLE_STATIONS) 7486 II II ||
# A set of constants, each representing a list index for station information.
ID = 0
%3D
NAME
1
%3D
LATITUDE
2
%3D
LONGITUDE
= 3
САРАСІTY
= 4
BIKES_AVAILABLE
DOCKS_AVAILABLE
5
6.
'SMART'
NO_KIOSK
# For use in the get_lat_lon_distance helper function
EARTH_RADIUS
6371
# SAMPLE DATA TO USE IN DOCSTRING EXAMPLES
SAMPLE_STATIONS
%3D
[7090, 'Danforth Ave / Lamb Ave',
43.681991, -79.329455, 15, 4, 10],
[7486, 'Gerrard St E / Ted Reeve Dr',
43.684261, -79.299332, 24, 5, 19],
[7571, 'Highfield Rd / Gerrard St E
43.671685, -79.325176, 19, 14, 5]]
SMART',
HANDOUT_STATIONS
[7000, 'Ft. York / Capreol Crt.',
43.639832, -79.395954, 31, 20, 11],
[7001, 'Lower Jarvis St SMART / The Esplanade',
43.647992, -79.370907, 15, 5, 10]]
expand button
Transcribed Image Text:# A set of constants, each representing a list index for station information. ID = 0 %3D NAME 1 %3D LATITUDE 2 %3D LONGITUDE = 3 САРАСІTY = 4 BIKES_AVAILABLE DOCKS_AVAILABLE 5 6. 'SMART' NO_KIOSK # For use in the get_lat_lon_distance helper function EARTH_RADIUS 6371 # SAMPLE DATA TO USE IN DOCSTRING EXAMPLES SAMPLE_STATIONS %3D [7090, 'Danforth Ave / Lamb Ave', 43.681991, -79.329455, 15, 4, 10], [7486, 'Gerrard St E / Ted Reeve Dr', 43.684261, -79.299332, 24, 5, 19], [7571, 'Highfield Rd / Gerrard St E 43.671685, -79.325176, 19, 14, 5]] SMART', HANDOUT_STATIONS [7000, 'Ft. York / Capreol Crt.', 43.639832, -79.395954, 31, 20, 11], [7001, 'Lower Jarvis St SMART / The Esplanade', 43.647992, -79.370907, 15, 5, 10]]
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education