Exerpad
Exercise 13 · Chapter: ListsOptional+50 XP

Checkerboard Text

Read a number n. Build an n by n grid where cells alternate between "X" and "O" in a checkerboard pattern. The top-left cell should be "X". Print each row by joining its items with spaces.

Hint: A cell at row r and column c is "X" when (r + c) is even.

Example:

Input:

3

Output:

X O X
O X O
X O X
Need a hint?
3 available · costs 5 XP each
python

Output
Run your code to see the output here.