adjacentElementsProduct
inputArray = [5, 1, 2, 3, 1, 4]
print ("list長度",len(inputArray))
b = []
for i in range(len(inputArray)):
if i > 0:
a = inputArray[i]*inputArray[i-1]
print (a)
b.append(a)
print (max(b))
print ("list長度",len(inputArray))
b = []
for i in range(len(inputArray)):
if i > 0:
a = inputArray[i]*inputArray[i-1]
print (a)
b.append(a)
print (max(b))
留言
張貼留言