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
2 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]2 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
Jane wants to add a chart to her presentation so she’ll click the Insert tab and in the Images group, she’ll click the Chart but
kap26 [50]

(A. Stevie only) because You need to go the illustrations tab in order to click on the chart button.

Jane clicked on images tab so she was wrong.

Mark as brainlest plz :)

3 0
3 years ago
Modify your previous exercise to determine if the user can ride a rollercoaster. To ride the rollercoaster, you must be at least
sweet-ann [11.9K]

Answer:

In Python:

age = int(input("How old are you? "))

height = float(input("How tall are you (inches)? "))

if age>=9 and height >= 42:

    print("You can ride the roller coaster")

else:

    print("You ca'nt ride the roller coaster")

Explanation:

The code segment of the "previous exercise" is not given; so, I rewrite the program from scratch using python.

And using the solution I provided, you'll have an idea of how to write the expected code If the "previous exercise" is not written in python,

This line prompts user for age

age = int(input("How old are you? "))

This line prompts user for height

height = float(input("How tall are you (inches)? "))

This checks if user is at least 9 years old and at least 42 inches tall

if age>=9 and height >= 42:

If true, the user gets to ride the roller coaster

    print("You can ride the roller coaster")

else:

If otherwise, the user will not ride the roller coaster

    print("You ca'nt ride the roller coaster")

4 0
3 years ago
The Grow Font button appears on the ____ tab.
Leni [432]
The Grow Font button appears on the home tab.
5 0
3 years ago
The windows logon process has unexpectedly terminated
dusya [7]

Answer

Windows corrupted

Explanation:

Try buying a new windows or resetting your laptop/pc

or your service failed to register/start

7 0
2 years ago
In a natural-language processing (NLP) system, the__________activity involves using the computer to read large amounts of text a
DedPeter [7]

Answer:

Analysis is the right suitable word to complete the sentence

Explanation:

It is because, Analysis is a concept, which means to judge any subjects and brings some original concept which is needed to take from the subjects.

Here in the above question the paragraph states about the summarize points taken from a large amount of data and analysis also mean the same and analysis is also the activity used in NLP for the same as above discussed.

4 0
3 years ago
Other questions:
  • What US agency originally started ARPANET?
    13·1 answer
  • An organization's IRP prioritizes containment over eradication. An incident has been discovered where an attacker outside of the
    14·1 answer
  • What is the default method of referencing cells in formulas?
    6·1 answer
  • A derived class is a class that inherits data members and functions from a ____ class.
    6·1 answer
  • Iman has 48 months to save $18,000, the maximum amount he estimates his first year of college will cost. He does not want to dep
    7·2 answers
  • What is the definition of the word uproot?
    15·1 answer
  • Can anybody do Algorithm 2 for me (with Python).<br> Answer = 25 points.
    13·1 answer
  • State Whether the given statement are TRUE OR FALSE. 13X1=13
    10·1 answer
  • 4.8 Code Practice: Question 1
    11·2 answers
  • What two things should you do before starting the design process
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!