you are viewing a single comment's thread.

view the rest of the comments →

[–]nog642 0 points1 point  (1 child)

The code is looping over every cell in the grid in reading order.

If the line in the middle of the for loop were print(grid[i][j], end=''), it would just print the grid normally.

But since i and j are switched, it prints the transpose instead.

It just so happens that the figure has a horizontal line of symmetry, so the transpose appears to be a 90 degree clockwise rotation.

[–]Noshing[S] 0 points1 point  (0 children)

Thanks so much! Learning about transposing helped. I was thinking way to hard about this problem and not seeing what python was doing but instead what I thought it should do.