def pickSubs(self, subjects, maxWork, maxLottery):
    totWork = 0
    totLott = 0
    studentSubs = []
    for s in subjects:
        totWork += s.getWork()
        totLott += s.getLottery()
        if totLott <= maxLottery and totWork <= maxWork:
                studentSubs.append(s)
    return studentSubs 
我正在尝试使用比较器根据不同的因素来决定学生的最佳选择。
我的问题是,如果总工作量和彩票值低于 maxWork、maxLottery,我想附加所有可能的对象“s”,但我没有附加所有可能的组合。我只是追加直到达到最大约束值
如何获得所有可能的组合?