mid_three

Given a list of ints of odd length, return a new list length 3 containing the elements from the middle of the list. The list length will be at least 3.

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, 4, 5]

Output:

[2, 3, 4]

Test 2

Input:

[8, 6, 7, 5, 3, 0, 9]

Output:

[7, 5, 3]

Test 3

Input:

[1, 2, 3]

Output:

[1, 2, 3]