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
pochemuha
3 years ago
12

Write a function named reverse_list that takes as a parameter a list and and reverses the order of the elements in that list. It

should not return anything - it should mutate the original list. This can be done trivially using slices, but your function must not use any slicing.
Computers and Technology
1 answer:
WITCHER [35]3 years ago
5 0

Answer:

The function in python is as follows:

def reverse_list(nums):

   half =int(len(nums)/2)

   for i in range(half):

       nums[i], nums[len(nums)-i-1] = nums[len(nums)-i-1],nums[i]

   print(nums)

Explanation:

This defines the function

def reverse_list(nums):

This gets the half the length of the list

   half =int(len(nums)/2)

This iterates through the list

   for i in range(half):

This swaps list items with the opposite item on the other half

       nums[i], nums[len(nums)-i-1] = nums[len(nums)-i-1],nums[i]

This prints the new list

   print(nums)

You might be interested in
Image files are grouped into two categories: _____.
EleoNora [17]
It is grouped according to raster and vector format. Raster format are images used in a computer or printed. Vector format stores data and is compressed. 

Examples of common raster formats usually used in a computer are; jpeg, png, bitmap, and gif. Vector formats are; CGM, SVG and 3D vector.
4 0
3 years ago
In order for the image tag in an HTML file to function properly, the file named square.png must be located where?
andrey2020 [161]
A is wrong because a folder can have any name.
B is wrong because not all folders of a web server are exposed to the outside, only all folders below the document root.
C sounds good
D is wrong because an image can reside somewhere else as long as you specify the absolute or relative path to it
7 0
3 years ago
Read 2 more answers
Berat wants to compare images of what the streets of New York City looked like one hundred years ago to now. Which of the follow
Vesnalui [34]

Answer:

I think the answer would be D.

7 0
3 years ago
Read 2 more answers
The limitation of trade secret protection for software is that it is difficult to prevent the ideas in the work from falling int
Lubov Fominskaja [6]

Answer:

The answer is "Option B".  

Explanation:

The main drawback of commercial security is, that the software may not protect digital technology against data mining, and they are not known to be the  imperial tools, that's why the only option B is correct, and certain options are wrong, which can be explained as follows:

  • In option A, It used to provide a sequence of instructions, which is used in security.  
  • In option C, It doesn't use in security, that's why it is wrong.
  • Option D and Option E are wrong because in software there is no use of court and new software, it only upgrades the software.
4 0
3 years ago
What does cpu stand for
lozanna [386]
Central processing unit.
7 0
3 years ago
Read 2 more answers
Other questions:
  • A (blank) is a way for students to keep track of information during research
    7·2 answers
  • The device used to connect a network to the internet is called a
    7·1 answer
  • Among the rights you have as a user of computing resources is the right to​ _______.
    12·2 answers
  • Many computer magazines and Web sites present comparisons of several DBMSs. Find one such DBMS comparison article and compare th
    10·1 answer
  • One study found that nearly ____________ of the 1600 college freshmen surveyed had sent sexually suggestive texts or photos.
    11·1 answer
  • A collection of computers and other hardware devices that are connected together to share hardware, software, and data, as well
    15·1 answer
  • Assume that the int variables i and j have been declared, and that n has been declared and initialized.
    10·1 answer
  • Fill in the blank with the correct response.
    10·1 answer
  • Which generation of computer is most popular and why?
    9·1 answer
  • What is the launching of a 3-D map called?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!