+ 1

What is meant by "subscriptable"? Why the code gives the output as shown?

l = [ 'ar' , [ 1 , 2 ]] print ( l[0][0][0][0][0][0][0][0]) #output = 'a' #but why print(l[1][1][1]) # Doesn't Give 2? #It gives TypeError: int object is not subscriptable.

9th Jul 2018, 11:20 AM
Aravind Shetty
Aravind Shetty - avatar
1 Odpowiedź
+ 5
l[0] = 'ar' 'ar'[0] = 'a' 'a'[0] = 'a'...
9th Jul 2018, 5:10 PM
Mert Yazıcı
Mert Yazıcı - avatar