예제 #1
0
def subsets(S):
    S.sort()
    return [list(c) for i in range(len(S)+1) for c in comb(S, i)]
예제 #2
0
def combine(n, k):
    return map(list, comb(range(1, n + 1), k))
예제 #3
0
def comb2(num):
    for (i1,n1), (i2,n2) in comb(num, 2):
        yield i1+i2, n1+n2
예제 #4
0
def comb2(num):
    for (i1,n1), (i2,n2) in comb(num, 2):
        yield i1+i2, n1+n2
예제 #5
0
def subsetsWithDup(S):
    S.sort()
    return [list(c) for i in xrange(len(S) + 1) for c in comb(S, i)]
예제 #6
0
def combine(n, k):
    return map(list, comb(range(1,n+1), k))