Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yet "an other" possibility, we use the sage specific Combinations. For instance:

sage: S = [1, 2, 3, 5]                                                                                                                                        
sage: Combinations(S, 2)                                                                                                                                      
Combinations of [1, 2, 3, 5] of length 2
sage: for A in Combinations(S, 2): 
....:     print(A) 
....:                                                                                                                                                         
[1, 2]
[1, 3]
[1, 5]
[2, 3]
[2, 5]
[3, 5]
sage: