1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gennadij [26K]
3 years ago
5

Primary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 or 95) go north/south, and evens (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, I-405 services I-5, and I-290 services I-90. It has to be done in python.
Computers and Technology
1 answer:
yanalaym [24]3 years ago
7 0

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

You might be interested in
Define a function below called increase_elements_by_x, which takes two arguments - a list of numbers and a single positive numbe
zubka84 [21]

Answer:

function

increase_elements_by_x (list, x)

{

 var tplist = [];

 for (i = 0; i < list.length; i++)

   {

     tplist[i] = list[i] + x;

   print (tplist[i])}

 return tplist;

}

var list =[1, 3, 5];

var copyList;

var x = 3;

copyList = increase_elements_by_x (list, x);

print (copyList);

Explanation:

Create a list named list with initial data 1,3,5.

Create a function name increase_elements_by_x  which takes list and number as argument.Create empty list tplist. Loop through list, for ever index add x to list[index] and save to an empty list tplist. After loop is exited return tplist.

create a variable copylist and set it to increase_elements_by_x. Value returned by increase_elements_by_x  will be saved in copylist. print copy list to see content of copy list.

5 0
4 years ago
Give an example of an if/else statment and a case statment that are equivalent. Your example should contain at least three choic
zimovet [89]

Answer:

The if - else and equivalent switch case statements in c++ language are given below.

if ( ch == 1 )

       cout << " sum is " << x + y << endl;

   else if ( ch == 2 )

       cout << " difference is " << x - y << endl;

   else if ( ch == 3 )

   {

       cout << " Quitting " << endl;

       exit;

   }

switch( ch )

   {

       case 1 :    cout << " Sum is " << x + y << endl;

                   break;

       case 2 :    cout << " Difference is " << x - y << endl;

                   break;

       case 3 :    cout << " Quitting " << endl;

                   break;

   }      

Explanation:

The above statements use three variables which are declared and initialized as shown.

int x = 10;

    int y = 25;

    int ch;

The above statements execute for of addition, subtraction or to quit the program.

cout << " 1. Addition " << endl;

    cout << " 2. Subtraction. " << endl;

    cout << " 3. Quit " << endl;

    cout << " Enter your choice " << endl;

The variable ch holds the numerical option entered by the user.

    cin >> ch;

For if - else statements, the if statement is executed based on the value of variable ch entered by the user. After execution, the compiler goes out of the statements automatically.

Following the if – else, if any statement is present, it will be executed.

For switch case, every case ends with break keyword. After the required case is executed based on the value of variable ch entered by the user, the break statement is executed which causes the switch case to terminate the control goes out of the statements.

Following the switch case, if any statement is present, it will be executed.

4 0
3 years ago
Ben installs high end stereo systems in customers homes. He travels to different job shes frequency. H e is best
lesya [120]

Answer:

the 1 answer is electronic home equipment installer

number 2 telecommunications equipment repairer

number 3 telecommunications line installer

number 4 radio mechanic

6 0
4 years ago
Read 2 more answers
Write a Python program that has subprograms nested four deep and in which each nested subprogram references local variables, var
Juliette [100K]

Answer:

Check the explanation

Explanation:

CODE:

global_var = "global" #accessible to all functions

def level0():

level0_var = "level 0" #accessible to level 0,1,2,3

print();

print("Level 0 function:")

print("global variable: ",global_var)

print("local variable 0: ",level0_var)

def level1():

print();

print("Level 1 function:")

level1_var = "level 1" ##accessible to level 1,2,3

print("global variable: ",global_var)

print("local variable 0: ",level0_var)

print("local variable 1: ",level1_var)

def level2():

print();

print("Level 2 function:")

level2_var = "level 2" #accessible to level 2,3

print("global variable: ",global_var)

print("local variable 0: ",level0_var)

print("local variable 1: ",level1_var)

print("local variable 2: ",level2_var)

def level3():

print();

print("Level 3 function:")

level3_var = "level 3" #accessible to level 3

print("global variable: ",global_var)

print("local variable 0: ",level0_var)

print("local variable 1: ",level1_var)

print("local variable 2: ",level2_var)

print("local variable 3: ",level3_var)

level3()

level2()

level1()

level0()

Kindly check the attached image below to see the output  (indentations are important):

6 0
4 years ago
What is a feature of readable code?
mamaluj [8]

Answer:

sorry for the wait but the answer is b

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • A video conferencing application isn't working due to a Domain Name System (DNS) port error. Which record requires modification
    15·1 answer
  • Jax needs to write a block of code that will organize a list of items alphabetically. Which function should he use? append() pri
    12·1 answer
  • Write a program that accepts 5 number and arrange them in ascending order​
    7·1 answer
  • If you hear that an airplane crashes into the Empire State Building, and you immediately think of the 9/11 terrorist attack on t
    9·1 answer
  • Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards
    9·1 answer
  • I have a question involving do and for loops while using arrays.
    8·1 answer
  • Who would win in a fight iron man or bat man​
    5·2 answers
  • Write a technical term for following statements
    15·1 answer
  • HELP ASAP IF YOU KNOW PYTHON 2!!!
    15·1 answer
  • Add the following numbers in abacus 2436+9214​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!