Lists · Beginner · 45 XP · about 5 min
Write a function called reverse_list(lst) that returns a new list with elements in reverse order.
Challenge: Try to solve this without using Python's built-in reverse() method or [::-1] slicing!
reverse_list([1, 2, 3, 4, 5]) # Returns [5, 4, 3, 2, 1] reverse_list(["a", "b", "c"]) # Returns ["c", "b", "a"] reverse_list([1]) # Returns [1]
Ready?
Accept the challenge to start writing. A small timer counts the time this page is in view.
Output appears here.