Looping over lists

Paul Rubin http
Sat May 5 02:00:59 EDT 2007


Tommy Grav <tgrav at mac.com> writes:
> In C this would be equivalent to:
> for(i = 0; i < n; i++) {
>     for(j=i+1; j < n; j++) {
> 	print a[i], a[j]

for i in xrange(n):
   for j in xrange(i+1, n):
     print a[i], a[j]



More information about the Python-list mailing list