Home > other >  A python list 2 d algorithm problem, ask for help
A python list 2 d algorithm problem, ask for help

Time:12-03

A class in the following group, the group has a different person inside,

Group_a=[]
Group_b=[]
Group_c=[]

Now need a batch number within the group
Has two input parameters, the minimum number of partial min_batch_count, each batch number biggest batch_max_num

First: requirements from each group choose a person inside,
The rest of the batch number: balanced selected from each group,

Please give code
Such as:
Group_a=[a1, a2, a3, a4 ']
Group_b=[' b1 ', 'b2]
Group_c=[' c1, c2, c3, c4, c5 ']

The minimum batch number is: 3
Each batch maximum number is: 3 (high priority)


The following results:
Batch_list=[
[' a1, b1, c1 '],
[' a2 ', 'b2', 'the c2]
[' a3 ', 'c3', 'c4]
[' c5 ', 'a4]
]


Def genBatches (group_list, min_batch_count batch_max_num) :
  • Related