Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

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:

text
3

Output:

text
X O X
O X O
X O X

💡 Hints

?Hint 1
🔒Hint 2
🔒Hint 3
python