Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THESE ARE THE CONSTANTS: ID_INDEX = 0 NAME_INDEX = 1 HIGHWAY_INDEX = 2 LAT_INDEX = 3 LON_INDEX = 4 YEAR_INDEX = 5 LAST_MAJOR_INDEX = 6

THESE ARE THE CONSTANTS:

ID_INDEX = 0 NAME_INDEX = 1 HIGHWAY_INDEX = 2 LAT_INDEX = 3 LON_INDEX = 4 YEAR_INDEX = 5 LAST_MAJOR_INDEX = 6 LAST_MINOR_INDEX = 7 NUM_SPANS_INDEX = 8 SPAN_LENGTH_INDEX = 9 LENGTH_INDEX = 10 LAST_INSPECTED_INDEX = 11 BCIS_INDEX = 12

MAX_BCIS = 5 HIGH_PRIORITY_BCI = 60 LOW_PRIORITY_BCI = 100

HIGH_PRIORITY_RADIUS = 500 LOW_PRIORITY_RADIUS = 100

EARTH_RADIUS = 6371

THREE_BRIDGES = [[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', [72.3, 69.5, 70.0, 70.3, 70.5, 70.7, 72.9]], [2, 'WEST STREET UNDERPASS', '403', 43.164531, -80.251582, '1963', '2014', '2007', 4, [12.2, 18.0, 18.0, 12.2], 61.0, '04/13/2012', [71.5, 68.1, 69.0, 69.4, 69.4, 70.3, 73.3]], [3, 'STOKES RIVER BRIDGE', '6', 45.036739, -81.33579, '1958', '2013', '', 1, [16.0], 18.4, '08/28/2013', [85.1, 67.8, 67.4, 69.2, 70.0, 70.5, 75.1, 90.1]] ]

EACH LIST[list(items)] REPRESENT AS SHOWN IN THE PICTURE:

image text in transcribedimage text in transcribed

THIS IS THE FUNCTION I NEED HELP WITH:

def get_bridges_with_bci_below(bridge_data: List[list], bridge_ids: List[int], bci_limit: float) -> List[int]: """Return the IDs of the bridges with ids in bridge_ids with a BCI less than or equal to bci_limit. >>> get_bridges_with_bci_below(THREE_BRIDGES, [1, 2], 72) [2] """

# TODO

please help me with this , there's the example but i dont know how to tackle the code

Index Data Type Description The ID of the bridge. 0 ID int The first bridge should have an ID of 1, the second should have an ID of 2, and so on. Your program must generate the ID numbers. Note: the original bridge labels are discarded. 1 Name str The name of the bridge. 2 Highway str The name of the bridge's highway. 3 Latitude float The latitude of the bridge. 4. Longitude float The longitude of the bridge. The year the bridge was built. 5 Year Built str If no year is provided, this will be an empty string. The year of the last major rehab. 6 Last Major Rehab str If no year is provided, this will be an empty string. The year of the last minor rehab. 7 Last Minor Rehab str If no year is provided, this will be an empty string. Number of The number of spans on the bridge. 8 int Spans A bridge will always have at least 1 span. The length of each of the spans of the bridge. 19 Span Details List[float] Total=64 (1)=12; (2)=19; (3)=21; (4)=12; And the bridge had 4 spans, then the formatted version should be the following list: [12.0, 19.0, 21.0, 12.0] The length of the bridge. 10 Bridge Length float If no length is provided, this will be 0.0. The date of the last inspection (in MM/DD/YYYY format). 11 Last Inspected Date str If no date is provided, this will be an empty string. A list of the BCls from the most recent to the least. 12 BCIS List[float] If the bridge has no BCls, then this should be an empty list. After applying the format_data function to the example list, it should look like: [ [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', [72.3, 69.5, 70.0, 70.3, 70.5, 70.7, 72.9]], [2, 'WEST STREET UNDERPASS', '403', 43.164531, -80.251582, '1963', '2014', '2007', 4, [12.2, 18.0, 18.0, 12.2], 61.0, 04/13/2012', [71.5, 68.1, 69.0, 69.4, 69.4, 70.3, 73.3]], [3, 'STOKES RIVER BRIDGE', '6', 45.036739, -81.33579, 1958', '2013', '', 1, [16.0], 18.4, '08/28/2013', [85.1, 67.8, 67.4, 69.2, 70.0, 70.5, 75.1, 90.1]] ] Before you write the format_data function body, please

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago