On Jul 2, 2008, at 10:34 PM, John H Palmieri wrote:

> On Jul 2, 10:09 pm, Rolandb <[EMAIL PROTECTED]> 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
>
> What about 'permutations([1,2,3,4])'?

Oh, yes, that is correct. I missed the "unique" requirement.

- Robert



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to