In JavaScript, I can use two (2) pointers to get the values from a list at the beginning and end and then increment/decrement the pointers to continue. For example:
for (let i = 0, j = list.length - 1; i < j; i++, j--) {
console.log(i, j);
}
How would I be able to accomplish the same in Python? I know that I can get the current index by doing:
for index in enumerate(list):
print(index)
But how could I also initialize another pointer to start from the end?
whileloop.