first_last_6

Given a list of ints, return true if 6 appears as either the first or last element in the list. The list will be length 1 or more.

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

Output:

True

Test 2

Input:

[6, 1, 2, 3]

Output:

True

Test 3

Input:

[13, 6, 1, 2, 3]

Output:

False

Test 4

Input:

[13, 6, 1, 2, 6]

Output:

True

Test 5

Input:

[3, 2, 1]

Output:

False

Test 6

Input:

[3, 6, 1]

Output:

False

Test 7

Input:

[3, 6]

Output:

True

Test 8

Input:

[6]

Output:

True

Test 9

Input:

[3]

Output:

False

Test 10

Input:

[5, 6]

Output:

True

Test 11

Input:

[5, 5]

Output:

False

Test 12

Input:

[1, 2, 3, 4, 6]

Output:

True

Test 13

Input:

[1, 2, 3, 4]

Output:

False