Respuesta :
Answer:
The solution in python.
Output:
print("0 is not a valid interstate highway number")
Explanation:
h = int(input("enter highway number: ")) #take highway number
if(h>=1 and h<=99): #for primary highway
if(h%2==0):
print("I-%d is primary, going east/west" %h) #for even highway number
else:
print("I-%d is primary, going north/south" %h) #for odd highway number
elif(h>=100 and h<=999): #for auxiliary highway
aux=str(h) #convert into string for fetch the rightmost number
l=len(aux) #find the length
val = aux[l-2]+aux[l-1] #assign value of rightmost two number
h = int(val) #convert into integer
if(h%2==0):
print("I-"+aux+" is auxiliary,"+"serving I-%d, going east/west" %h)
else:
print("I-"+aux+" is auxiliary,"+"serving I-%d, going north/south" %h)
elif(h==0):#for 0 highway number
print("0 is not a valid interstate highway number")
else:
pass
In this exercise we have to use the knowledge of the python language to write the code, so we have to:
The code is in the attached photo.
So to make it easier the code can be found at:
Output:
print("0 is not a valid interstate highway number")
Explanation:
h = int(input("enter highway number: ")) #take highway number
if(h>=1 and h<=99): #for primary highway
if(h%2==0):
print("I-%d is primary, going east/west" %h) #for even highway number
else:
print("I-%d is primary, going north/south" %h) #for odd highway number
elif(h>=100 and h<=999): #for auxiliary highway
aux=str(h) #convert into string for fetch the rightmost number
l=len(aux) #find the length
val = aux[l-2]+aux[l-1] #assign value of rightmost two number
h = int(val) #convert into integer
if(h%2==0):
print("I-"+aux+" is auxiliary,"+"serving I-%d, going east/west" %h)
else:
print("I-"+aux+" is auxiliary,"+"serving I-%d, going north/south" %h)
elif(h==0):#for 0 highway number
print("0 is not a valid interstate highway number")
else:
pass
See more about python at brainly.com/question/26104476
