I keep getting this error when trying to reference a nested list. I know I must be within the actual range of the list, yet i still get the error
self = list()
for index in points:
if(index[0]==x or index[1]==y):
self.append(index)
Above is the assignment to self. Points (which is what im referencing) is another nested list. This code works perfectly, but when i try to index the list as such :
self[0][0]
i get the following :
IndexError: list index out of range
print(self[1][0])
Line 17 in nearestValidPoint (Solution.py)
ret = Solution().nearestValidPoint(param_1, param_2, param_3)
Line 57 in _driver (Solution.py)
_driver()
Line 68 in <module> (Solution.py)
When I try to print the original list points, it STILL throws me this error, IE:
print(points[1][0])
prints a single integer (which is expected) but the error is still thrown
X and Y are user inputted integers. The code I provided is the entire code