What am i supposed to do in 1.1 list accessing? Some one plz help me... ;-)
Please post your well formatted code or the exercise instructions.
I t starts off like this:
n = [1, 3, 5]
The instructions are to print out the second element. How do I do this.
Yea @byteace83915 im not sure if this applies to python but the list order is 0, then 1 then two.. It always starts with index 0... So correct solution would be:
n = [1, 3, 5] print n
Understand or need clarification?
I do need clarification.
oh now I get it nevermind.
Index(In Most Languages)
Ok so, basically when you do an array lets say:
n = [1,2,3,4,5,6]
Well you might think element 1 in that array is index 1. But An Array ALWAYS, starts in index 0, in all the langauges i learned atleast.. So if you want to acess the element 1.. you would do
So now lets say now you want element with the value 4... Ok so lets start to count from 0 and reach to 4.
Elements [ 1, 2, 3, 4, 5, 6 ] INDEX 0 1 2 3 4 5
So as you can see in above diagram element with value 4 is in index position 3. So then you do:
Still need clarification?