0

What is the output and why?

What is the output? What type of indexing is this? a = [5,4,3,2,1,0] print(a[a[a[2]+1]])

20th Jul 2022, 2:13 PM
David Holmes Ng'andu
David Holmes Ng'andu - avatar
2 ответов
+ 4
evaluation of order: a[ a[ a[2]+1 ] => a[2] => 3 a[2]+1 = 3+1 => 4 a[ a[2]+1 ] = a[ 4 ] => 1 a[ a[ a[2]+1 ] = a[ 1 ] => 4 Outouts : 4 Hope it helps..
20th Jul 2022, 2:19 PM
Jayakrishna 🇮🇳
- 3
Manav Roy still not a proper explaination.
20th Jul 2022, 2:18 PM
David Holmes Ng'andu
David Holmes Ng'andu - avatar