mirror of
https://github.com/satwikkansal/wtfpython
synced 2024-11-22 11:04:25 +01:00
Correct the snippet in Tic-tac-toe explanation
Fixes https://github.com/satwikkansal/wtfpython/issues/81
This commit is contained in:
parent
169fa2fb5e
commit
518881c70e
2
README.md
vendored
2
README.md
vendored
@ -530,7 +530,7 @@ 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).
|
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
|
```py
|
||||||
>>> board = [(['']*3)*3] # board = = [['']*3 for _ in range(3)]
|
>>> board = [['']*3 for _ in range(3)]
|
||||||
>>> board[0][0] = "X"
|
>>> board[0][0] = "X"
|
||||||
>>> board
|
>>> board
|
||||||
[['X', '', ''], ['', '', ''], ['', '', '']]
|
[['X', '', ''], ['', '', ''], ['', '', '']]
|
||||||
|
Loading…
Reference in New Issue
Block a user