Skip to content

Commit 240e216

Browse files
committed
Update explanation: Tic tac toe
Fixes satwikkansal#68
1 parent a0100a8 commit 240e216

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,15 @@ And when the `board` is initialized by multiplying the `row`, this is what happe
502502
503503
![image](/images/tic-tac-toe/after_board_initialized.png)
504504
505+
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).
506+
507+
```py
508+
>>> board = [(['']*3)*3] # board = = [['']*3 for _ in range(3)]
509+
>>> board[0][0] = "X"
510+
>>> board
511+
[['X', '', ''], ['', '', ''], ['', '', '']]
512+
```
513+
505514
---
506515
507516
### ▶ The sticky output function

0 commit comments

Comments
 (0)