Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def create_example_bridge_1() -> list: Return a bridge in our list-format to use for doctest examples. This bridge is the same as the bridge from row

def create_example_bridge_1() -> list: """Return a bridge in our list-format to use for doctest examples.

This bridge is the same as the bridge from row 3 of the dataset. """

return [ 1, 'Highway 24 Underpass at Highway 403', '403', 43.167233, -80.275567, '1965', '2014', '2009', 4, [12.0, 19.0, 21.0, 12.0], 65.0, '04/13/2012', [['2013', '2012', '2011', '2010', '2009', '2008', '2007', '2006', '2005', '2004', '2003', '2002', '2001', '2000'], [MISSING_BCI, 72.3, MISSING_BCI, 69.5, MISSING_BCI, 70.0, MISSING_BCI, 70.3, MISSING_BCI, 70.5, MISSING_BCI, 70.7, 72.9, MISSING_BCI]] ]

https://data.ontario.ca/dataset/bridge-conditions/resource/703cdf01-ff09-4b86-b017-6e8d87b11fd2

COLUMN_ID = 0 COLUMN_NAME = 1 COLUMN_HIGHWAY = 2 COLUMN_LAT = 3 COLUMN_LON = 4 COLUMN_YEAR_BUILT = 5 COLUMN_LAST_MAJOR_REHAB = 6 COLUMN_LAST_MINOR_REHAB = 7 COLUMN_NUM_SPANS = 8 COLUMN_SPAN_DETAILS = 9 COLUMN_DECK_LENGTH = 10 COLUMN_LAST_INSPECTED = 11 COLUMN_BCI = 12

INDEX_BCI_YEARS = 0 INDEX_BCI_SCORES = 1 MISSING_BCI = -1.0

EARTH_RADIUS = 6371

def get_bridge_condition(bridges: List[list], bridge_id: int) -> float: """Return the most recent BCI score of the bridge in bridges with id bridge_id.

The most recent BCI score is the BCI score given to the bridge in the highest (i.e., most recent) year. If there is no score for every year, return MISSING_BCI.

>>> example_bridges = create_example_bridges() >>> get_bridge_condition(example_bridges, 1) 72.3 """

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

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions