has_77

Given a list of ints, return true if the list contains two 7’s next to each other, or there are two 7’s separated by one element, such as with {7, 1, 7}.

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

Output:

True

Test 2

Input:

[1, 7, 1, 7]

Output:

True

Test 3

Input:

[1, 7, 1, 1, 7]

Output:

False

Test 4

Input:

[7, 7, 1, 1, 7]

Output:

True

Test 5

Input:

[2, 7, 2, 2, 7, 2]

Output:

False

Test 6

Input:

[2, 7, 2, 2, 7, 7]

Output:

True

Test 7

Input:

[7, 2, 7, 2, 2, 7]

Output:

True

Test 8

Input:

[7, 2, 6, 2, 2, 7]

Output:

False

Test 9

Input:

[7, 7, 7]

Output:

True

Test 10

Input:

[7, 1, 7]

Output:

True

Test 11

Input:

[7, 1, 1]

Output:

False

Test 12

Input:

[1, 2]

Output:

False

Test 13

Input:

[1, 7]

Output:

False

Test 14

Input:

[7]

Output:

False