+ 2
explain negative indexing [1::-3],[1::-2],[1::-5],
What is the output of this code? S= "Welcome" print(s[2::-4])
7 Antworten
+ 3
You could yourself test and play with this code in SL playground. In this way you can better understand how that works.
+ 1
now get
+ 1
Thanks everyone
0
the index value of -1 gives the last element, and -2 gives the second last element of an array. The negative indexing starts from where the array ends. This means that the last element of the array is the first element in the negative indexing which is -1.
0
Please Correct Me if iam wrong
0
yes you are correct but -4 means you can count form last number to forth
0
I didn't get