reverse_3

Given a list of ints length 3, return a new list with the elements in reverse order, so [1, 2, 3] becomes [3, 2, 1].

This exercise was taken from codingbat.com and has been adapted for the Python language. There are many great programming exercises there, but the majority are created for Java.

Test 1

Input:

[1, 2, 3]

Output:

[3, 2, 1]

Test 2

Input:

[5, 11, 9]

Output:

[9, 11, 5]

Test 3

Input:

[7, 0, 0]

Output:

[0, 0, 7]

Test 4

Input:

[2, 1, 2]

Output:

[2, 1, 2]

Test 5

Input:

[1, 2, 1]

Output:

[1, 2, 1]

Test 6

Input:

[2, 11, 3]

Output:

[3, 11, 2]

Test 7

Input:

[0, 6, 5]

Output:

[5, 6, 0]

Test 8

Input:

[7, 2, 3]

Output:

[3, 2, 7]