Can anyone help me understand below Python code?
In[41]: list_a = [1, 2, 3, 4] In[42]: list_a[True] Out[42]: 2 In[43]: list_a[False] Out[43]: 1
True is interpreted as 1 so list_a[True] is equivalent to list_a[1] same for list_a[False] => list_a[0]
True
list_a[True]
list_a[1]
list_a[False]
list_a[0]
1.4m articles
1.4m replys
5 comments
57.0k users