Question: I really need help with this. Please create these following functions in python. The data can be found here: https://www.ontario.ca/data/bridge-conditions def get_total_length_on_highway(bridge_data: List[list], highway: str)
I really need help with this. Please create these following functions in python.
The data can be found here: https://www.ontario.ca/data/bridge-conditions
def get_total_length_on_highway(bridge_data: List[list], highway: str) -> float: """Return the total length of bridges in bridge_data on highway. Use zero for the length of bridges that do not have a length provided. If there are no bridges on highway, return 0.0. >>> get_total_length_on_highway(THREE_BRIDGES, '403') 126.0 >>> get_total_length_on_highway(THREE_BRIDGES, '401') 0.0 """
def get_distance_between(bridge1: list, bridge2: list) -> float: """Return the distance in kilometres, rounded to the nearest metre (i.e., 3 decimal places), between the two bridges bridge1 and bridge2. >>> get_distance_between(get_bridge(THREE_BRIDGES, 1), \ get_bridge(THREE_BRIDGES, 2)) 1.968 """
def find_closest_bridge(bridge_data: List[list], bridge_id: int) -> int: """Return the id of the bridge in bridge_data that has the shortest 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 """
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
