Gingerbread Gingerbread - 11 months ago 92
Python Question

Python-list expression output

a=["four", "score", "and", "seven", "years"][[0,2,3][1]]


print(a)

output is :
and


What is the main logic of this expression ?

Answer Source

[0,2,3][1] gives 2 which goes into ["four", "score", "and", "seven", "years"][2] which in turn returns and.