7 lines
160 B
Python
7 lines
160 B
Python
|
|
def comb(m, s):
|
||
|
|
if m == 0: return [[]]
|
||
|
|
if s == []: return []
|
||
|
|
return [s[:1] + a for a in comb(m-1, s[1:])] + comb(m, s[1:])
|
||
|
|
|
||
|
|
print comb(3, range(5))
|