Question: Based on a text file that resembles a tic tac toe board: XXX OOX OOX Please complete the rest of this program: boardfile = open(tictactoe_board.txt)

Based on a text file that resembles a tic tac toe board:

XXX

OOX

OOX

Please complete the rest of this program:

boardfile = open("tictactoe_board.txt") board = boardfile.read() boardfile.close() rows = board.split(' ') print(rows) 

A. Add to or modify the code I've given you so that it prints an error message if the number of rows is not exactly 3.

B. Make it so that an error message is printed if the number of columns is not exactly 3. (i.e. if any row has fewer or more than 3 characters).

C. Make it so that a message is printed if any of the rows is three-in-a-row (either X or O).

[Extra Credit] Make it so that a message is printed if there is three in a row horizontally, vertically, or diagonally.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!