On Mon, May 31, 2010 at 8:17 AM, Xavier Ho <cont...@xavierho.com> wrote:
>
>> >>> list(combinations_with_replacement('01',3))
>> ('0', '0', '0')
>> ('0', '0', '1')
>> ('0', '1', '1')
>> ('1', '1', '1')
>>
>> Is it possible to get combinations_with_replacement to return numbers
>> rather than strings? (see above)
>
>>>> list(combinations_with_replacement(range(0,2), 3))
> [(0, 0, 0), (0, 0, 1), (0, 1, 1), (1, 1, 1)]

Thanks, for some reason I didn't combinations_with_replacement took a
list as an argument.

> Hopefully that'll give you some ideas.
>
> Cheers,
> Xav
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to