adjacentProduct=lambdaarr:max(arr[i]*arr[i+1]foriinrange(len(arr)-1))cases=[([1,2,3],6),([3,4,5],20),([3,7,9],None),([-3,-4,15],None),([-4,-1,-10],None),]forarg,ansincases:print(f"adjacentProduct({arg}) = {adjacentProduct(arg)}{f'; answer should be: {ans}' if ans else ''}.")ifall(adjacentProduct(arg)==ansforarg,ansincasesifans):print('All test cases are correct')else:print('NOT all test cases are correct')
Python 3 oneliner with testcases and TIO link:
Try it online!