So one issue I discovered with python is that it is not very user-friendly to create nested loops each with their own indexes.
How would I write the Python-equivalent of this Java code:
for(int i = 0; i < array.length-2; i++){
for(int j = i+1; j < array.length-1; j++){
for(int k = j+1; k < array.length; k++){
Notice how I reference the counter value of the predecessor's for each nested loop. I tried using:
for idx, val in enumerate(nums[:-2]):
but it seems like idx
will always start at 0 rather than start at the predecessor's index value. Is there a better solution besides maintaining separate counter variables?