Untitled

mail@pastecode.io avatarunknown
python
a month ago
281 B
5
Indexable
Never
def checkerboard(rows=8, cols=8):
    WHITE = 'X'
    BLACK = 'O'
    for i in range(rows):
        row = []
        for j in range(cols):
            if (i+j)%2 == 0:
                row.append(WHITE)
            else:
                row.append(BLACK)
        print(''.join(row))