0
print([1,2,3,4][1:3][1]) #please explane Output
This Outputs: 3 Why?
6 Respuestas
+ 4
Array index start from 0, right?
So, [1,2,3,4] [1:3] will get you numbers at index 1 to 3 (3 will be excluded), which will be [2,3]. Ok?
And [2,3] [1] ? What'll get?
Guess it! You can do it.
Hope it helps! :)
+ 3
[1,2,3,4][1:3]=[2,3]
[2,3][1]=3
+ 3
Andreas wo hing es denn jetzt?
+ 2
Andreas , first the slice =>[2, 3](slices the list from index 1 to 3 excluded) and then the element at index 1 is 3.
+ 1
now I get it! thank you
+ 1
ich habe nicht kapiert das ein index operator sich auf den vorherigen index operator beziehen kann