Project: Reverse a list in place

Write a function named reverse_list that takes a list of numbers and reverses the order of its elements. It does not return anything. It changes the original list. Your function must not use slicing.

vals = [2, -5, 10, 9]
reverse_list(vals)
print(vals)  # This should print [9, 10, -5, 2]

Save the file as reverse_list.py.

Show a solution

Try the project on your own first. This is one working solution, followed by its tests. Press Run to run the tests. Read them to see what thorough testing looks like, then change the solution and run again to watch a test fail.

Projects run on your own computer, so you tell us when you are done.