Question
Data can be found on this website: https://www.ontario.ca/data/bridge-conditions ####### BEGIN HELPER FUNCTIONS #################### def read_data(csv_file: TextIO) -> List[List[str]]: data = [] lines = csv.reader(csv_file) for
Data can be found on this website: https://www.ontario.ca/data/bridge-conditions
####### BEGIN HELPER FUNCTIONS ####################
def read_data(csv_file: TextIO) -> List[List[str]]: data = [] lines = csv.reader(csv_file) for line in lines: data.append(line) data = data[2:] return data
def calculate_distance(lat1: float, lon1: float, lat2: float, lon2: float) -> float: lon1, lat1, lon2, lat2 = (math.radians(lon1), math.radians(lat1), math.radians(lon2), math.radians(lat2))
# haversine formula t lon_diff = lon2 - lon1 lat_diff = lat2 - lat1 a = (math.sin(lat_diff / 2) ** 2 + math.cos(lat1) * math.cos(lat2) * math.sin(lon_diff / 2) ** 2) c = 2 * math.asin(math.sqrt(a)) return round(c * EARTH_RADIUS, 3)
###NO NEED TO MODIFY THESE###
Given the helper function and the data please create these functions. Thank you
Note: You do not have to use these helper functions in the program. The helper function read_data is there to convert the CVS file and return its contents as a List[List[str]].
def get.bridge(bridge_data: ListClist], bridge.id: int) -list: ""Return the data for the bridge with id bridge.id from bridge data.If there is no bridge with the given id, return an empty list >result-get bridge(THREE BRIDGES, 1) >result - [1, Highway 24 Underpass at Highway 403', 403', 43.167233, -80.275567, '1965', 2014', '2009', 4, C12.0, 19.0, 21.0, 12.0], 65, '04/13/2012', [72.3, 69.5, 70.0, 70.3, 70.5, 70.7, 72.91] True # TODO def get average.bci(bridge_data: Listlist], bridge_id: int) ->float: " "Return the average BCI for the bridge with bridge id from bridge_data. If there is no bridge with the id bridge.id, return 0.0. If there are no BCIs for the bridge with id bridge id, return 0.0 get average bci CTHREE_BRIDGES, 1) 70.88571428571429 # TODO def get.total.length on highwayCbridge_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 highwayCTHREE_BRIDGES, '403' 126.0 >get total.length.on highwayCTHREE_BRIDGES, '401' 0.0 #TODOStep 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