middle_way

Given 2 int lists, a and b, each length 3, return a new list length 2 containing their middle elements.

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, 6]

Output:

[2, 5]

Test 2

Input:

[7, 7, 7]
[3, 8, 0]

Output:

[7, 8]

Test 3

Input:

[5, 2, 9]
[1, 4, 5]

Output:

[2, 4]

Test 4

Input:

[1, 9, 7]
[4, 8, 8]

Output:

[9, 8]

Test 5

Input:

[1, 2, 3]
[3, 1, 4]

Output:

[2, 1]

Test 6

Input:

[1, 2, 3]
[4, 1, 1]

Output:

[2, 1]