Gingerbread Gingerbread - 1 year ago 126
Python Question

Python-list expression output

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


output is :

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download