Example Input: 90 Output: I-90 is primary, going east/west. Input: 290 Output: I-290 is auxiliary, serving I-90, going east/west. Input: 0 Output: WARNING: 0 is not a valid interstate highway number. Input: 200 Output: WARNING: 200 is not a valid interstate highway number. See Wikipedia for more info on highway numbering. 414136.2652726.qx3zqy7 LAB ACTIVITY 1 def...(): 2 3 3.20.1: LAB: Interstate Highway Numbers 4 5 if name == "__main__": 6 7 8 9 highway_number = int(input()) # TODO: finish the main program main.py 0/14 Load default template...

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Example
Input:
90
Output:
I-90 is primary, going east/west.
Input:
290
Output:
I-290 is auxiliary, serving I-90, going east/west.
Input:
0
Output:
WARNING: 0 is not a valid interstate highway number.
Input:
200
Output:
WARNING: 200 is not a valid interstate highway number.
See Wikipedia for more info on highway numbering.
414136.2652726.qx3zqy7
LAB
ACTIVITY
3.20.1: LAB: Interstate Highway Numbers
1 def ...():
2
3
4
5 if _name__ == "__main__":
6
7
8
9
highway_number = int(input())
# TODO: finish the main program
main.py
0/14
Load default template...
Transcribed Image Text:Example Input: 90 Output: I-90 is primary, going east/west. Input: 290 Output: I-290 is auxiliary, serving I-90, going east/west. Input: 0 Output: WARNING: 0 is not a valid interstate highway number. Input: 200 Output: WARNING: 200 is not a valid interstate highway number. See Wikipedia for more info on highway numbering. 414136.2652726.qx3zqy7 LAB ACTIVITY 3.20.1: LAB: Interstate Highway Numbers 1 def ...(): 2 3 4 5 if _name__ == "__main__": 6 7 8 9 highway_number = int(input()) # TODO: finish the main program main.py 0/14 Load default template...
Primary U.S. interstate highways are numbered 1-99.
• Odd numbers (like the 5 or 95) go north/south, and even numbers (like the 10 or 90) go east/west.
• Auxiliary highways are numbered 100-999, and service the primary highway indicated by the rightmost two digits. Thus, 1-405 services
1-5, and 1-290 services 1-90.
Given a highway number, indicate whether it is a primary or auxiliary highway. If auxiliary, indicate what primary highway it serves. Also,
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 main program to
produce the requested output.
Instructions
The functions
Write a function get_direction () that expects a highway 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 return value is
east/west
Write a function get_primary_hwy () that expects an auxiliary highway number. The function returns the primary highway it serves; 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
I-90
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/else). If it is primary, print the primary highway information as shown in the example below.
If the highway is not primary, call the get_primary_hwy(). Print the auxiliary highway information as shown in the example below.
Transcribed Image Text:Primary U.S. interstate highways are numbered 1-99. • Odd numbers (like the 5 or 95) go north/south, and even numbers (like the 10 or 90) go east/west. • Auxiliary highways are numbered 100-999, and service the primary highway indicated by the rightmost two digits. Thus, 1-405 services 1-5, and 1-290 services 1-90. Given a highway number, indicate whether it is a primary or auxiliary highway. If auxiliary, indicate what primary highway it serves. Also, 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 main program to produce the requested output. Instructions The functions Write a function get_direction () that expects a highway 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 return value is east/west Write a function get_primary_hwy () that expects an auxiliary highway number. The function returns the primary highway it serves; 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 I-90 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/else). If it is primary, print the primary highway information as shown in the example below. If the highway is not primary, call the get_primary_hwy(). Print the auxiliary highway information as shown in the example below.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY