Skip to content

Commit

Permalink
Update explanation: Tic tac toe
Browse files Browse the repository at this point in the history
  • Loading branch information
satwikkansal committed Feb 25, 2018
1 parent 9aeaaa6 commit 388ac16
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,15 @@ And when the `board` is initialized by multiplying the `row`, this is what happe

![image](/images/tic-tac-toe/after_board_initialized.png)

We can avoid this scenario here by not using `row` variable to generate `board`. (Asked in [this](https://github.com/satwikkansal/wtfpython/issues/68) issue).

```py
>>> board = [(['']*3)*3] # board = = [['']*3 for _ in range(3)]
>>> board[0][0] = "X"
>>> board
[['X', '', ''], ['', '', ''], ['', '', '']]
```

---

### ▶ The sticky output function
Expand Down

0 comments on commit 388ac16

Please sign in to comment.