Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me complete these functions i'm so desperate Here are the constants: COLUMN_ID = 0 COLUMN_NAME = 1 COLUMN_HIGHWAY = 2 COLUMN_LAT = 3

please help me complete these functions i'm so desperate

Here are the constants:

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

And here's an example of a bridge that is a list:

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

--------------------------------

these are the questions i can't figure out

def find_bridge_by_id(bridges: List[list], bridge_id: int) -> list: """Return the data for the bridge with id bridge_id from bridges.

If there is no bridge with the given id in bridges, then return an empty list.

>>> example_bridges = create_example_bridges() >>> find_bridge_by_id(example_bridges, 4) [] >>> find_bridge_by_id(example_bridges, 2) == create_example_bridge_2() True """

-------------------------------------------------------------

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 """ ---------------------------------------------------

def clean_length_data(raw_length: str) -> float: """Return the length of the bridge based on the value in raw_length.

If raw_length is an empty string, return 0.0.

Precondition: - if raw_length is not the empty string, it can be converted to a float

>>> clean_length_data('12') 12.0 """

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

What are some major limitations of twisted-pair wire?

Answered: 1 week ago

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago