mirror of
https://github.com/satwikkansal/wtfpython
synced 2024-11-22 02:54:25 +01:00
Update explanation: Tic tac toe
Fixes https://github.com/satwikkansal/wtfpython/issues/68
This commit is contained in:
parent
a0100a8b48
commit
240e216c51
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
|
||||
|
||||
![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
|
||||
|
Loading…
Reference in New Issue
Block a user