li = [0, 1, 2, 3] running = True while running: for elem in li: thiselem = elem nextelem = li[li.index(elem)+1]
When this reac
A rather different way to solve this:
li = [0,1,2,3] for i in range(len(li)): if i < len(li)-1: # until end is reached print 'this', li[i] print 'next', li[i+1] else: # end print 'this', li[i]