Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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]].

image text in transcribed

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 #TODO

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

Students also viewed these Databases questions

Question

5/8 - &=190

Answered: 1 week ago

Question

Describe why communication is vital to everyone?

Answered: 1 week ago

Question

Explain the various techniques of Management Development.

Answered: 1 week ago

Question

4. Show the trainees how to do it again.

Answered: 1 week ago

Question

8. Praise the trainees for their success in learning the task.

Answered: 1 week ago