triple_up

Return true if the list contains, somewhere, three increasing adjacent numbers like …. 4, 5, 6, … or 23, 24, 25.

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

Output:

True

Test 2

Input:

[1, 2, 3]

Output:

True

Test 3

Input:

[1, 2, 4]

Output:

False

Test 4

Input:

[1, 2, 4, 5, 7, 6, 5, 6, 7, 6]

Output:

True

Test 5

Input:

[1, 2, 4, 5, 7, 6, 5, 7, 7, 6]

Output:

False

Test 6

Input:

[1, 2]

Output:

False

Test 7

Input:

[1]

Output:

False

Test 8

Input:

[]

Output:

False

Test 9

Input:

[10, 9, 8, -100, -99, -98, 100]

Output:

True

Test 10

Input:

[10, 9, 8, -100, -99, 99, 100]

Output:

False

Test 11

Input:

[-100, -99, -99, 100, 101, 102]

Output:

True

Test 12

Input:

[2, 3, 5, 6, 8, 9, 2, 3]

Output:

False