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
Korolek [52]
3 years ago
13

Given the lists list1 and list2 that are of the same length, create a new list consisting of the last element of list1 followed

by the last element of list2, followed by the second to last element of list1, followed by the second to last element of list2, and so on (in other words the new list should consist of alternating elements of the reverse of list1 and list2). For example, if list1 contained [1, 2, 3] and list2 contained [4, 5, 6], then the new list should contain [3, 6, 2, 5, 1, 4]. Associate the new list with the variable list3.

Computers and Technology
1 answer:
Inessa [10]3 years ago
6 0

Answer:

list1 = [1, 2, 3]

list2 = [4, 5, 6]

list3 = []

newlist = []

for i in list1:

   for j in list2:

       if list1.index(i) == list2.index(j):

           newlist.append(j)

           newlist.append(i)

           break

   

for i in reversed(newlist):

   list3.append(i)

print(list3)

Explanation:

The programming language used is python.

List 1 and 2 are initialized, and two empty lists are initialized too, these two lists are going to be used in generating the new list.

Two FOR loops are used for both list one and two respectively, to iterate through their content, the IF statement and the break is placed within the for loop to ensure that there is no repetition.

The index of list 1 and list 2 are appended (added) to a new list one at a time.

The new list is then reversed and its content are added to list 3 to give the final solution.

NOTE: The reason a separate list was created was because the reversed() function does not return a list, so in order to get the list, it must be added to an empty list as you reverse it.

You might be interested in
The name of a person their address and their contact information like phone number and email address or consider the minimum inf
andrew-mc [135]

Answer:

false

Explanation:

6 0
4 years ago
Access is generally used to work with ________ databases.
d1i1m1o1n [39]

Answer:

access is generally used to work with relational databases

8 0
3 years ago
All presentations should have this
drek231 [11]
The correct answer is B.
4 0
3 years ago
Read 2 more answers
Class of Service utilizes 8 levels of priority, and modifies the PCP field in an 802.1Q tag.
Alenkasestr [34]

Answer:

True.

Explanation:

When there is delay and congestion in the network, we have to assign priority to some packets to avoid data loss. Class of service (CoS) does this prioritization by grouping similar traffic types such as ,voice, streaming video,e-mail etc. into classes.then it utilizes different levels(usually eight) of priority.It also modifies PCP field in 802.1q tag.

4 0
3 years ago
Microsoft Access is a
AnnyKZ [126]
Microsoft Access is a database management system from Microsoft that combines the relational Microsoft Jet Database Engine with a graphical user interface and software-development tools.
4 0
3 years ago
Other questions:
  • What are the tiny little dots that make up a digital photograph?
    8·2 answers
  • Your company runs a commercial website that enables your business partners to purchase products and manage their accounts. You w
    9·1 answer
  • If you wanna buy a Monitor, please explain why you wanna buy it! PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!
    9·1 answer
  • I want to know all the part of computer system
    14·1 answer
  • Which software application should be used to communicate in writing about an upcoming event?
    12·2 answers
  • The NFiPA 704 system uses a numerical value between _____ and _____ to indicate the level of hazard for that particular chemical
    6·2 answers
  • LAB: Count multiples (EO)
    5·1 answer
  • Using complete sentences post a detailed response to the following.
    13·1 answer
  • The _____ method randomly rearranges the items in the list provided in the parentheses.
    5·2 answers
  • Select the one that uses the heading tag correctly. <br><br>a. <br><br><br>b. <br><br>c. <br><br>d.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!