I want to take a list like:
x = [1,2,2,3,4,6,6]
and return a 2d list with the indexes of the repeating values:
[ [1,2], [5,6]]
I've tried the following:
new_list = []
i = 0
while i < len(x)-1:
if x[i] == x[i+1]:
new_list.append([x[i],x[i+1]]
i += 1
x is not necessarily sorted but has at least one series of repeating values. For example x can also be:
x = [1,4,2,3,3,3,7,0]