Toggle Questions

Put the blocks in order to define the function has22 to return True if there are at least two items in the list nums that are adjacent and both equal to 2, otherwise return False. For example, return True for has22([1, 2, 2]) since there are two adjacent items equal to 2 (at index 1 and 2) and False for has22([2, 1, 2]) since the 2’s are not adjacent.

Finish the function has22 below to return True if there are at least two items in the list nums that are adjacent and both equal to 2, otherwise return False. For example, return True for has22([1, 2, 2]) since there are two adjacent items equal to 2 (at index 1 and 2) and False for has22([2, 1, 2]) since the 2’s are not adjacent.

You have attempted of activities on this page