Untitled

mail@pastecode.io avatar
unknown
python
a year ago
281 B
5
Indexable
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))