...

/

A Tic-tac-toe Where X Wins in the First Attempt!

A Tic-tac-toe Where X Wins in the First Attempt!

We'll cover the following...

Who doesn’t like to win tic-tac-toe? But what happens if the game is biased against you? Let’s learn to level the playing field.

Press + to interact
empty_cell = ""
# Let's initialize a row
row = [empty_cell] * 3 #row i['', '', '']
# Let's make a board
board = [row] * 3
print(board)
print(board[0])
print(board[0][0])
board[0][0] = "X"
print(board)

We didn’t assign three "X"s, did we?

Explanation

When we initialize the row variable, this visualization explains what happens in the memory ...