Solution 1

def reverse_list(a_list):
    return a_list[::-1]

Reverse list

Write a function reverse_list that reverses a list. Example

reverse_list([1, 2, 3, 4]) == [4, 3, 2, 1]

Test Cases

test reverse list - Run Test

def test_reverse_list():
    assert reverse_list([4, 3, 2, 1]) == [1, 2, 3, 4]

test reverse list with empty list - Run Test

def test_reverse_list_with_empty_list():
    assert reverse_list([]) == []
def reverse_list(a_list): pass