RosettaCodeData/Task/Combinations/Python/combinations-4.py
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

6 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))