Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Data can be found on this website: https://www.ontario.ca/data/bridge-conditions (there is alot of data here so that is why I had to give it in a
Data can be found on this website: https://www.ontario.ca/data/bridge-conditions (there is alot of data here so that is why I
had to give it in a link. Sorry in advance >.
Note: The helper function read_data is there to convert the CVS file and return its contents as a List[List[str]].
def get.distance_between(bridge1: list, bridge2: list) -> float: "Return the distance in kilometres, rounded to the nearest metre Ci.e., 3 decimal places), between the two bridges bridgel and bridge2 >>>get_distance_betweenCget_bridge(THREE_BRIDGES, 1), 1.968 # Hint: use the provided helper function calculate-distance "" "Return the id of the bridge in bridge_data that has the shortest get_bridge(THREE_BRIDGES, 2)) def find_closest_bridge(bridge_data: ListClist], bridge id: int) -> int: distance to the bridge with id bridge_id Precondition: a bridge with bridge id is in bridge_data, and there are at least two bridges in bridge_data >>>find_closest_bridge(THREE_BRIDGES, 2) 1 def find_ bridges_in_radius(bridge_data: List[list], lat: float, long: float, distance: float)-ListLint]: ""Return the IDs of the bridges that are within radius distance from Clat, long) >>>find_bridges in_radius(THREE_BRIDGES, 43.10, -80.15, 50) def get_bridges_with_bci_below(bridge_data: List[list], bridge ids: List[int], bci_limit: float) -ListDint]: ""Return the IDs of the bridges with ids in bridge ids whose most recent BCIs are less than or equal to bci_limit. >>>get_bridges_with_bci_belowCTHREE_BRIDGES, [1, 2], 72) 12] def get_bridges_containing(bridge_data: List[list], search: str) -> List[int]: Return a list of IDs of bridges whose names contain search (case insensitive). >>>get_bridges_containingCTHREE_BRIDGES, 'underpass 1, 2 >>>get_bridges_containingCTHREE_BRIDGES, 'Highway C11 def get.distance_between(bridge1: list, bridge2: list) -> float: "Return the distance in kilometres, rounded to the nearest metre Ci.e., 3 decimal places), between the two bridges bridgel and bridge2 >>>get_distance_betweenCget_bridge(THREE_BRIDGES, 1), 1.968 # Hint: use the provided helper function calculate-distance "" "Return the id of the bridge in bridge_data that has the shortest get_bridge(THREE_BRIDGES, 2)) def find_closest_bridge(bridge_data: ListClist], bridge id: int) -> int: distance to the bridge with id bridge_id Precondition: a bridge with bridge id is in bridge_data, and there are at least two bridges in bridge_data >>>find_closest_bridge(THREE_BRIDGES, 2) 1 def find_ bridges_in_radius(bridge_data: List[list], lat: float, long: float, distance: float)-ListLint]: ""Return the IDs of the bridges that are within radius distance from Clat, long) >>>find_bridges in_radius(THREE_BRIDGES, 43.10, -80.15, 50) def get_bridges_with_bci_below(bridge_data: List[list], bridge ids: List[int], bci_limit: float) -ListDint]: ""Return the IDs of the bridges with ids in bridge ids whose most recent BCIs are less than or equal to bci_limit. >>>get_bridges_with_bci_belowCTHREE_BRIDGES, [1, 2], 72) 12] def get_bridges_containing(bridge_data: List[list], search: str) -> List[int]: Return a list of IDs of bridges whose names contain search (case insensitive). >>>get_bridges_containingCTHREE_BRIDGES, 'underpass 1, 2 >>>get_bridges_containingCTHREE_BRIDGES, 'Highway C11
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