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
20
denis-greek [22]

Answer:

true

Explanation:

because my 8 ball said so

6 0
3 years ago
A file has a name and an
3241004551 [841]

Answer:

extension

Explanation:

3 0
2 years ago
ONCE AGAIN Can somebody explain the difficulties and hardships of being a computer engineering?
Lynna [10]

Answer:

The only thing I can think of, is stress. I cannot tell you how frustrating it is when you're writing code and it decides to bug out because of some little mistake. For hours you're writing and find out that you're missing a single ";" or an indent.

When you're writing out code in order to solve a problem, you need to break it down step by step in order to actually write it. Otherwise, you'll miss a bunch of steps

6 0
2 years ago
why does a computer only need to use the colors red, green, and blue to display any image? please give reasonable answers
Bezzdna [24]

the human eye has 3 cones (red, green and blue)

Explanation:

if you mix each color very precisely on a screen, you can simulate different colors that trick the eyes into thinking they are seeing something else.

8 0
3 years ago
Which descriptions offer examples of Programming and Software Development workers? Check all that apply.
dezoksy [38]

Answer:

Dude there are no examples

Explanation:

4 0
2 years ago
Read 2 more answers
Other questions:
  • In your presentation you added a text box to?
    5·1 answer
  • Suppose I define some structure type ( studentInfo), then I declare an instance of it and I decide to also create a pointer to t
    10·1 answer
  • What additive keeps engines clean by preventing contaminates and deposits from collecting on surfaces? a. Friction modifiers b.
    10·2 answers
  • In full screen reading view the blank is reduced
    5·1 answer
  • Advertising andpublicity are used to:
    9·1 answer
  • State why hexadecimal is used to display the error code
    11·1 answer
  • What is modularity?
    9·1 answer
  • Davids family took him to a hospital as he was suffering from a sericous ailment
    8·1 answer
  • Which formula is a simple formula?<br> O =E10/5+1<br> 0 -5+A1*B1<br> O =C3+10-E3<br> 0 =10-(A3-D13)
    9·1 answer
  • You are trying to sell a new product to a store owner. Which method of presentation
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!