Question: highway _ number = int ( input ( ) ) # Check if the highway number is valid if 1 < = highway _ number

highway_number = int(input())
# Check if the highway number is valid
if 1<= highway_number <=99:
# Primary highway
direction = "north/south" if highway_number %2!=0 else "east/west"
print(f"I-{highway_number} is primary, going {direction}.")
elif 100<= highway_number <=999:
# Auxiliary highway
primary_highway = highway_number %100
direction = "north/south" if primary_highway %2!=0 else "east/west"
print(f"I-{highway_number} is auxiliary, serving I-{primary_highway}, going {direction}.")
elif highway_number ==100 or highway_number %100==0:
# Invalid highway number with last two digits as "00"
print(f"{highway_number} is not a valid interstate highway number.")
else:
# Invalid highway number
print(f"{highway_number} is not a valid interstate highway number.")
I cant get case 4 to output correctly. 1:Primary (90)
1/1
Input
90
Your output
I-90 is primary, going east/west.
2:Auxiliary (290)
1/1
Input
290
Your output
I-290 is auxiliary, serving I-90, going east/west.
3:Invalid (0)
1/1
Input
0
Your output
0 is not a valid interstate highway number.
4:Compare output
0/1
Output differs. See highlights below.
Special character legend
Input
200
Your output
I-200 is auxiliary, serving I-0, going east/west.
Expected output
200 is not a valid interstate highway number.
5:Compare output
2/2
Input
5
Your output
I-5 is primary, going north/south.
6:Compare output
2/2
Input
405
Your output
I-405 is auxiliary, serving I-5, going north/south.
7:Compare output
2/2
Input
1000
Your output
1000 is not a valid interstate highway number.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!