table.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:PokerBot 作者: KanishkT123 项目源码 文件源码
def permutation(current, indices):
    """
    Permutes a certain section of a list and returns all permutations
        -current: current list/input list
        -indices: All indices to be permuted (assumes that all indices
                  sequential)
    """
    indices.sort()
    permuter = [current[a] for a in indices]
    permutations = [list(x) for x in list(itertools.permutations(permuter))]
    temp1 = current[:min(indices)]
    temp2 = current[max(indices)+1:]
    alllist = []
    for i in permutations:
        alllist.append(temp1 + i + temp2)
    return alllist
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号