Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thank you for the answer. I think I could use this to fill 6 groups randomly with the 60 students. Since the numbers of students in each group is larger than the number of groups, the problem is difficult to solve (cf. social golfer problem). In my case, between two sessions, each teacher could, one after the other, use this program to generate the composition of his new group (10 new students among 60-10n students he never had yet, n being the session's number).

from random import shuffle
a=[[i] for i in range(60)]
n=len(a)/10
shuffle(a)
results=[[a[i] for i in range(j*10,j*10+10)] for j in range(0,n)]
results