mirror of
https://github.com/satwikkansal/wtfpython
synced 2025-07-04 20:38:06 +02:00
Update explanation: Tic tac toe
Fixes https://github.com/satwikkansal/wtfpython/issues/68
This commit is contained in:
parent
a0100a8b48
commit
240e216c51
1 changed files with 9 additions and 0 deletions
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue