day20/puzzle1.py
def rotate(tile):
    """Rotate 90 degrees counter-clockwise."""
    old = tile.split("\n")
    N = len(old)
    new = [["." for n in range(N)] for m in range(N)]

    for m, row in enumerate(old):
        for n, cell in enumerate(row):
            new[N-1-n][m] = cell

    new = "\n".join(["".join(row) for row in new])
    return new
Rotate 90 degrees counter-clockwise.
Rotate 90 degrees counter-clockwise.
Rotate 90 degrees counter - clockwise .
def rotate(tile):
    old = tile.split("\n")
    N = len(old)
    new = [["." for n in range(N)] for m in range(N)]
    for m, row in enumerate(old):
        for n, cell in enumerate(row):
            new[N-1-n][m] = cell
    new = "\n".join(["".join(row) for row in new])
    return new
def rotate ( tile ) : old = tile . split ( "\n" ) N = len ( old ) new = [ [ "." for n in range ( N ) ] for m in range ( N ) ] for m , row in enumerate ( old ) : for n , cell in enumerate ( row ) : new [ N - 1 - n ] [ m ] = cell new = "\n" . join ( [ "" . join ( row ) for row in new ] ) return new
Rotate 90 degrees counter-clockwise.
Rotate 90 degrees counter - clockwise .
"""Rotate 90 degrees counter-clockwise."""
tile