Nov-18-2019, 08:28 PM
Why does
print([0][0])output 0 ?
strange output
|
Nov-18-2019, 08:28 PM
Why does
print([0][0])output 0 ?
left-hand
[0] is a list with one element - 0.the right-hand [0] is indexing - you access the 0-indexed element, which is 0to be more clear print([1][0]) will print 1
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
Nov-19-2019, 09:24 AM
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Strange output | kintarowonders | 6 | 4,233 |
May-08-2020, 05:20 PM Last Post: buran |
|
Strange output with regular expressions | newbieAuggie2019 | 1 | 2,472 |
Nov-04-2019, 07:06 PM Last Post: newbieAuggie2019 |