Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

debug based on the errors reported python Primary U.S interstate highways are numbered 199 - Odd numbers (iike the 5 or 95 ) go north/scuth,

debug based on the errors reported
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
python
Primary U.S interstate highways are numbered 199 - Odd numbers (iike the 5 or 95 ) go north/scuth, and even nurnbers (like the 10 or 90 ) go east/west. - Acciliary highways are numbered 100999, and servioe the primary highway indicated by the rightmost two digiss Thus, W05 servoss i5 , and 1.290 services 190 Given a highway number indicate whether it is a primary or auxiliary highway If auxiliary, indicate what primary highway it serves Alsa. indicate if the (primary) highway runs north/south or east/west Use the information above to write several functions to help you determine this information. Call these functions in your maln orogram to produce the requested output. Instructions The functions. Write a function get_direction () that expects a higiway number: - Returns a string "north/south' if the highway number is odd (like the 5 or 95 ); - Returns 'east/west' if the highway number is even (like the 10 or 90 ). If the function is called with the following input 290 the refurn value is Wrte a function get_prisary_hwy () that expects an ausilaty highway numbet. The functan returns the primary lighway it semns the return value is a string. The function returns None if the highway number is less than 100 If the function is called with the following input 290. the return value is 190 The main program Ask the user to input a highway number. Check if it is a valid highway number If it is not valid, print the warning as shown below if it is valid, proceed with the rest of the program Get the highway direction by calling the get_direction() function. Check if the highway is primary (use the if/e Lse). If it is primary, ptint the primary highway information as thown in the exarnple below. If the highwoy is not primary, call the get__ primary hwy (). Print the auxiliary highway information as shown in the example below. Example Example input: Output t-90 is frittazy, going eant/weat. Inpot 290 Output: I-200 in abxiliary, acxying 190, going aast/went. input: Dutput: WhRNTNGi a is not a valid interatate highway nuwer. input 200 Output WARUING: 200 if not a talid interatate highvay numbor. See Wikioedia for more info on highway numbering: if highway_number >=100 and highway_number 999 : print (f'WARNING: \{highway_nueber\} is not a valid interstate hi ghway number.') \# ToDo: finish the main progrant 9.Unit test 0/2 Test the get primary hwy0 function with input 245 Check your function carefuliy, it returns an incorrect value. Test feedback Xour code returned I-245 is auxiliary, serving I-45, going north/south. Expected: I 45

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 Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

Explain the different methods for measuring customer service.

Answered: 1 week ago

Question

Excel caculation on cascade mental health clinic

Answered: 1 week ago