"kumar s" <[EMAIL PROTECTED]> wrote > a = [10,15,18,20,25,30,40] > > I want to print > 10 15 (first two elements) > 16 18 (16 is last number +1) > 19 20
The simplest solution would seem to be a while loop: print a[0], a[1] # special case index = 1 while index < len(a): print a[index-1]+1, a[index] index += 1 But that seems too straightforward to be the solution, so I assume I'm missing something? -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor