> > S=0; > A=0; > n=len(L1) > for i in range(n): > for j in range(i+1,n,1): > A+=1; > if (L1[i]>L1[j] and L2[i]>L2[j]) or (L1[i]<L1[j] and > L2[i]<L2[j]) or (L1[i]==L1[j] and L2[i]==L2[j]): > S+=1 > > print(100*float(S)/A) >
In this code, A is equal to (len(L1)*( len(L1)-1)/2), but I had left it this way for later sanity check. >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor