Timeline for I'm having a problem with python in relation to tuples
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 18, 2020 at 15:35 | answer | added | Serge Ballesta | timeline score: 1 | |
| Nov 18, 2020 at 15:33 | vote | accept | Pedro | ||
| Nov 18, 2020 at 15:31 | comment | added | Tomerikoo |
That big if doesn't evaluate as you want it to. A more Pythonic way to express that condition is: if not all(tab[i][j] in (1, -1, 0) for i in range(3) for j in range(3))
|
|
| Nov 18, 2020 at 15:31 | history | reopened | Serge Ballesta python Users with the python badge or a synonym can single-handedly close python questions as duplicates and reopen them as needed. | ||
| Nov 18, 2020 at 15:30 | history | closed |
Tomerikoo tripleee python Users with the python badge or a synonym can single-handedly close python questions as duplicates and reopen them as needed. |
Duplicate of Why does "a == x or y or z" always evaluate to True? How can I compare "a" to all of those? | |
| Nov 18, 2020 at 15:28 | history | edited | Tomerikoo | CC BY-SA 4.0 |
deleted 9 characters in body; edited title
|
| Nov 18, 2020 at 15:19 | answer | added | peter554 | timeline score: 1 | |
| Nov 18, 2020 at 15:15 | comment | added | Niloct |
You're almost there. The or expression is wrong. Do 2 for loops, one for the rows, other nested for the columns, and check if the current position is different from 1, -1 or 0.
|
|
| Nov 18, 2020 at 15:12 | history | asked | Pedro | CC BY-SA 4.0 |