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]
2 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]2 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
"Random Bars" is considered to be a Transition style<br> O True<br> O False
Vesnalui [34]
True….hope it helps love
8 0
2 years ago
Terri needs to insert a cover page into her document. Where should she go to access the commands to do so? Insert tab, Objects g
dexar [7]

Answer:

Insert tab, Pages group

Explanation:

It just be like dat

7 0
2 years ago
How does Google work, why does it work that way?
Oxana [17]

Answer:

Google uses automated programs called spiders or crawlers, just like most search engines, to help generate its search results. Google has a large index of keywords that help determine search results. ... Google uses a trademarked algorithm called PageRank, which assigns each Web page a relevancy score.

8 0
3 years ago
Read 2 more answers
Which slide elements must Claire use to enhance her presentation?
Alja [10]
She needs to use animations to enhance her presentation
8 0
2 years ago
Which formula is used to measure accuracy?
Westkost [7]

Answer:You can only find REaccuracy if you know the actual “true” measurement… something that's difficult to do unless you're measuring against the atomic clock. The formula is: REaccuracy = (Absolute error / “True” value) * 100%.

Explanation:

7 0
2 years ago
Other questions:
  • Of the different IRT roles, the _______________ is head of the team and issues the ultimate call regarding how to respond to an
    15·1 answer
  • Data arranged and stored in a data set
    9·1 answer
  • Plz answer me will mark as brainliest picture included ​
    15·1 answer
  • Which represents the hierarchical structure of a Google Analytics account from top to bottom?
    5·1 answer
  • Someone help ASAP! Match the type of information system with its description.
    13·2 answers
  • Write a program that allows two players to play a game of tic-tac-toe. Use a two dimensional char array with three rows and thre
    7·1 answer
  • "What line of code can be used to provide a convenient way to merge the source code from one file with the source code in anothe
    8·1 answer
  • A sales transaction was coded with an invalid customer account code (XXX-XX-XXX rather than XXX-XXX-XXX). The error was not dete
    12·1 answer
  • A carver begins work on the following block of granite that weighs 2700 g. What is the density of the granite?
    13·1 answer
  • Which of the following is the most reliable way to check the accuracy of a website?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!