What is meant by "subscriptable"? Why the code gives the output as shown? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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 Réponse
+ 5
l[0] = 'ar' 'ar'[0] = 'a' 'a'[0] = 'a'...
9th Jul 2018, 5:10 PM
Mert Yazıcı
Mert Yazıcı - avatar