+ 1
Why is the outpot of the last line of code single digit?
7 Antworten
+ 3
Because you told it to look at the index 2 of the first array, and then the index 1 of the retrieved array, which is 2.
https://code.sololearn.com/ctxaMS43CS50/#py
number = 3
things = ["string", 0, [1, 2, number], 4.56]
print("Index 2 of first array is: ", things[2])
print("Index 1 of array above is: ", things[2][1])
:::: Output :::::
Index 2 of first array is: [1, 2, 3]
Index 1 of array above is: 2
+ 2
@Tahir Iqbal
I'm confused why you would show up on this thread, contribute nothing and then reference another thread you created that isn't even related to this thread?
+ 1
Yeah it's a single digit
+ 1
Bcuz the array "things" has an another array in it which is [1,2,3]
+ 1
[1,2,3] has a index of 2 in the things array and hence, in which, the index 1 belongs to a single number,i.e 2
0
I need answer
https://www.sololearn.com/discuss/1810804/?ref=app