How about
for a, b, c, d in cartesian_product_iterator([range(5)]*4):
print a, b, c, d
- Robert
On Jul 2, 2008, at 10:09 PM, Rolandb wrote:
>
> Suppose you want to select all possible combinations a,b,c,d to from
> the range [1,2,3,4] , but a,b,c,d should be unique (thus not equal).
> The following approach seems clumsy:
>
> for a in range(1,5):
> for b in range(1,5):
> for c in range(1,5):
> for d in range(1,5):
> if a<>b<>c<>d:
> print a,b,c,d
>
> Is there a smarter way? Thanks in advance!
> Roland
> >
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---