[Tutor] for loop results into list

Micheal Beatty mikelbt at gmail.com
Sun Sep 5 20:06:38 CEST 2010


  Hello all,

I'm having a little problem figuring out how to accomplish this simple 
task. I'd like to take a list of 6 numbers and add every permutation of 
those numbers in groups of four. For example for 1, 2, 3, 4, 5, 6 add 1 
+ 1 + 1 +1 then 1 + 1 + 1 +2 etc. until reaching 6 + 6 + 6 + 6. Using a 
for loop, that was the easy part, now I'd like to take the results and 
count the number of times each number occurs.
My problem occurs when I try to create a list from the results of the 
for loop, it puts each individual number into its own list. I've looked 
everywhere for the solution to this and can find nothing to help.

Any suggestions would be much appreciated

Thanks
mwb


More information about the Tutor mailing list