rotation matricielle en python

def rotate(matrix):
    rows = len(matrix)
    cols = len(matrix[0])
    res = []
    for i in range(cols):
        temp = []
        for j in range(rows):
            temp.append(matrix[j][i])
        res.append(temp[::-1])

    return res


matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(rotate(matrix))
Prabhu Kiran Konda