
上QQ阅读APP看书,第一时间看更新
Dereferencing a single element
If you want to dereference a single element of the list you can just use the bracket like that:
y[1]
The output of the above code is as follows:
11
So y[1] will return element 1. Remember that y had 10, 11, 12 in it - observe the previous example, and we start counting from 0, so element 1 will actually be the second element in the list, or the number 11 in this case, alright?