Jan-19-2018, 05:32 AM
So I am practicing the following
https://practice.geeksforgeeks.org/probl...n-second/0
I was writing this program and got hung up on an error...
Quote:Given two arrays of size N1 and N2 respectively, the task is to calculate the product of max element of first array and min element of second array.
https://practice.geeksforgeeks.org/probl...n-second/0
I was writing this program and got hung up on an error...
Quote:Traceback (most recent call last):
File "C:\Users\groundZero Admin\Documents\Python\arrayPracetice1.py", line 22, in <module>
y = A[i]
IndexError: list index out of range
#Given two arrays of size N1 and N2 respectively, the task is to #calculate the product of max element of first array and min #element of second array. # # A = [1, 50, 2, 7, 3, 8] B = [1, 50, 2, 7, 3, 8, 75, 77, 0] listALength = len(A) listBLength = len(B) #These print functions were used to test the len function on arrays during #this study session. They're now commented out to make them inactive. #print(listALength) #print(listBLength) #Take the length of the array - 1 to increment the list via a loop x = A[0] for i in A: y = A[i] if y > x: x = y print(x)Please help me! Thank you!