Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python please make these 2 functions given some sampe data. Please show the code as well, thank you def g et_total_length_on_highway (bridge_data: List[list], highway:

In python please make these 2 functions given some sampe data. Please show the code as well, thank you

def get_total_length_on_highway(bridge_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_highway(THREE_BRIDGES, '403')--example of what the function should output 126.0 >>> get_total_length_on_highway(THREE_BRIDGES, '401')--example of what the function should output 0.0 """

def find_closest_bridge(bridge_data: List[list], bridge_id: int) -> int: """Return the id of the bridge in bridge_data that has the shortest distance to the bridge with id bridge_id. Precondition: a bridge with bridge_id is in bridge_data, and there are at least two bridges in bridge_data >>> find_closest_bridge(THREE_BRIDGES, 2)--example of what the function should output 1 """

the following data is for bridge_data

LOCATION INFORMATION

ID

STRUCTURE

HWY NAME

LATITUDE

LONGITUDE

YEAR BUILT

LAST MAJOR REHAB

LAST

MINOR REHAB

# OF SPANS

SPAN DETAILS

DECK LENGTH

LAST INSPECTION DATE

CURRENT

BCI

2013

2012

2011

2010

2009

2008

2007

2006

2005

2004

2003

2002

2001

2000

1 - 32/

Highway 24 Underpass at Highway 403

403

43.167233

-80.275567

1965

2014

2009

4

Total=64 (1)=12;(2)=19;(3)=21;(4)=12;

65

04/13/2012

72.3

72.3

69.5

70

70.3

70.5

70.7

72.9

1 - 43/

WEST STREET UNDERPASS

403

43.164531

-80.251582

1963

2014

2007

4

Total=60.4 (1)=12.2;(2)=18;(3)=18;(4)=12.2;

61

04/13/2012

71.5

71.5

68.1

69

69.4

69.4

70.3

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

Students also viewed these Databases questions