mirror of
https://github.com/satwikkansal/wtfpython.git
synced 2025-08-08 06:06:30 +02:00
Update explanation: Tic tac toe
Fixes https://github.com/satwikkansal/wtfpython/issues/68
This commit is contained in:
9
README.md
vendored
9
README.md
vendored
@@ -502,6 +502,15 @@ And when the `board` is initialized by multiplying the `row`, this is what happe
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
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
|
### ▶ The sticky output function
|
||||||
|
Reference in New Issue
Block a user