Post

Jimmy Fikes
Jimmy Fikes@akajim·
@PythonPr 4. a[-0] is the same as a[0], so 1. a[-1] is 3. So, 1 + 3 is 4.
English
0
0
2
173
Othieno Michael Edwards
Othieno Michael Edwards@EdwardsOthieno·
@PythonPr 1. a[-0] is the same as a[0] 2. a[-1] points to the last item in the list. a[-2] is the second last item and a[-3] is the first item (a reverse sequence) 3. print(a + b) = 1 + 3 = 4
English
0
0
2
206
Jeff
Jeff@Jeff72571425107·
@PythonPr a = [1,2,3] b = a[-0] # Egyptian zero {-} ignored a[0]=1 c = a[-1] # start at the end of the list a[-1]=3 print(b + c) #print 4 {1+3} # -4 and 3 throw subscript range errors valid values -3<=n<=2 a[ -3 ] = 1 a[ -2 ] = 2 a[ -1 ] = 3 a[ 0 ] = 1 a[ 1 ] = 2 a[ 2 ] = 3
English
0
0
0
120
Paylaş