+ 1
Can someone explain me the first question of the Module 2 Quiz ?
I don't understand the part with : print(list[list[4]]) Why is there list twice ?
4 Respuestas
+ 2
See if this makes sense to you:
list = [1, 2, 3, 4]
print( list[1] ) # this equals to 2
So,
list[ list[1] ] = list[2]
+ 1
This example will help you:
You have an array (named "list") with these elements.
list[6]={1,2,3,4,5,0}. If you want to output list[list[4]] is the same like list[5]=0, because list[4]=5 (first index of array elements is 0). So just separate and calculate from inside...Hope you understood it...
+ 1
Oh yes ! I understood !
Thank you so much ;)
+ 1
I didn't understand the result one list was the call for the other. Now it's okay !
Thank you Ledio and Gustavo