max_triple

Given a list of ints of odd length, look at the first, last, and middle values in the list and return the largest. The list length will be a least 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

Test 2

Input:

[1, 5, 3]

Output:

5

Test 3

Input:

[5, 2, 3]

Output:

5

Test 4

Input:

[1, 2, 3, 1, 1]

Output:

3

Test 5

Input:

[1, 7, 3, 1, 5]

Output:

5

Test 6

Input:

[5, 1, 3, 7, 1]

Output:

5

Test 7

Input:

[5, 1, 7, 3, 7, 8, 1]

Output:

5

Test 8

Input:

[5, 1, 7, 9, 7, 8, 1]

Output:

9

Test 9

Input:

[5, 1, 7, 3, 7, 8, 9]

Output:

9

Test 10

Input:

[2, 2, 5, 1, 1]

Output:

5