I'm trying to 'rotate' a grid 90 degrees clockwise and came up with the following Python code.
def rotate90(grid):
    rotatedGrid = grid[:]
    for i in range (0, len(grid)):
        for j in range (0, len(grid)):
            rotatedGrid[i][j] = grid[-(j+1)][i][:]
    return rotatedGrid
printing rotate90(grid) on the grid [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']] outputs [['7', '4', '7'], ['8', '5', '4'], ['9', '4', '7']], whereas I expected [['7', '4', '1'], ['8', '5', '2'], ['9', '6', '3']]. What is the reason for this difference?
(The reason I haven't converted these to ints is that eventually I will be using '@' and '-' characters rather than numbers.)
 
     
    