help with code for combinations/permutations
Peter Renzland
N010117clp at dancing.org
Wed Jan 17 15:24:35 EST 2001
Bryan Webb wrote on 17 Jan 2001 18:37:44 GMT:
> I wasnt as clear as I should have been. (as usual)
> I really need to come up with all the possible sums of the numbers in the
> list ie. 1 , sum(1 + 2), sum(1 + 2 + 3) ,sum( 1+2+4),sum( 1 + 3) and so on.
Hm. What are you going to do with "all the possible sums", and when?
Have you considered how many such sums there are? And do you care
about duplicates? If you only want "all the *different sums", there are
exactly 136 of them. Is that what you want?
If not, brace yourself for a long wait :-)
--
Peter
More information about the Python-list
mailing list