LearnPy Hub
← Classes & Objects problems
Hard

Tic-Tac-Toe Board

Write class Board with play(row, col) (players X and O take turns, X first) and winner() returning X, O or None. Read moves r c (0–2) until END or until someone wins, and print the winner, or Draw if the board is full, or Unfinished.

Input

Moves, then END.

Output

One word.

Sample 1

Input
0 0
1 1
0 1
2 2
0 2
END
Output
X

Sample 2

Input
1 1
END
Output
Unfinished
solution.py
Output appears here
Tic-Tac-Toe Board · Python practice problem · LearnPy Hub