0

What does this part "(n[m])" in the code below?

https://code.sololearn.com/cufhBUrO6558/?ref=app I played with the numbers in the hope I could find it out myself, but I still have no idea. Thanks in advance

14th Sep 2018, 6:54 AM
Klaartje
Klaartje - avatar
3 Respostas
+ 1
It accesses the m-th entry of array of array n. The indices start from 0. n=[23,1,2,3] n[0] = 23 # first entry of n at position 0 n[1] = 1 n[2] = 2 n[3] = 3 # last position, since the array has 4 entries and the indices 0-3 cover them all Another example: x = 3 arr = [7,3,36,87,1,9] print(arr[x]) # output: 87
14th Sep 2018, 7:07 AM
Matthias
Matthias - avatar
+ 1
Woehoe! Thanks Supriya and Matthias! Now it's clear for me! 💡🤔 💡⚡. 😊
14th Sep 2018, 7:50 AM
Klaartje
Klaartje - avatar