+ 2

Python: nested list and *operator with lists.

Can anyone explain why the output of this code is 9 ? x=[0,[2,4,6],[13,11,9]] y=x[2]+x[1]*2 print(y[x[1][0]])

27th Dec 2017, 4:59 PM
Jędrzej Leszczyński
Jędrzej Leszczyński - avatar
1 Respuesta
+ 2
x[1][0]=2 y[2]=9 because y starts with 13, 11, 9...
27th Dec 2017, 5:06 PM
Petr Leliaev
Petr Leliaev - avatar