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 rowrow = [empty_cell] * 3 #row i['', '', '']# Let's make a boardboard = [row] * 3print(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 ...