fix_23

Given an int list length 3, if there is a 2 in the list immediately followed by a 3, set the 3 element to 0. Return the changed list.

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:

[1, 2, 0]

Test 2

Input:

[2, 3, 5]

Output:

[2, 0, 5]

Test 3

Input:

[1, 2, 1]

Output:

[1, 2, 1]

Test 4

Input:

[3, 2, 1]

Output:

[3, 2, 1]

Test 5

Input:

[2, 2, 3]

Output:

[2, 2, 0]

Test 6

Input:

[2, 3, 3]

Output:

[2, 0, 3]