hi
i have started again recently with python and im just abit confused about this iteration:
def maxProduct(array):
arrayLength = len(array)
if(arrayLength < 2):
print("No pairs exists")
return
x = array[0]; y = array[1]
for i in range(arrayLength):
******** for j in range(i + 1, arrayLength): **************
if(array[i] * array[j] > x * y):
x = array[i]; y = array[j]
return x, y
nums = [1,2,3,4,7,0,8,4]
print("Original array:", nums)
print("Maximum product pair is:", maxProduct(nums))
nums = [0,-1,-2,-4,5,0,-6]
print("\nOriginal array:", nums)
print("Maximum product pair is:", maxProduct(nums))
now i please need help with the for j in range thats in the line with stars. I want to know why the start of the range function is i + 1 and not 0 like the for in loop above it?