try something such as

combo = range(1,5)
for a in combo[:]:
    combo.remove(a)
    for b in combo[:]:
        combo.remove(b)
        for c in combo[:]:
            combo.remove(c)
            for d in combo[:]:
                print a,b,c,d
            combo.append(c)
        combo.append(b)
    combo.append(a)

On Jul 3, 12:09 am, 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

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