I
Ishwor
Hi all. Look at this snippet of code.
It prints the value 'a'. Fine so far
l[0] ---> 'a' .
l[0][0]---> 'a'[0] --> 'a'.
l[0][0][0] ---> 'a'[0][0] --> 'a'[0] --> 'a'
Now why doesnt this list which holds integer seem to work??
Traceback (most recent call last):
File "<pyshell#244>", line 1, in -toplevel-
l[0][0]
TypeError: unsubscriptable object
Traceback (most recent call last):
File "<pyshell#246>", line 1, in -toplevel-
1[0]
TypeError: unsubscriptable object
The compiler reports unsubscriptable object ?? confused , dazzled i am ???!!??
The same list now holds integer instead of strings and l[0][0][0]
which worked fine earlier on strings doesn't seem to work on
integers???
Any help is greatly appreciated.
'a'l = ['a','b','c','d']
l ['a', 'b', 'c', 'd']
l[0][0][0]
It prints the value 'a'. Fine so far
l[0] ---> 'a' .
l[0][0]---> 'a'[0] --> 'a'.
l[0][0][0] ---> 'a'[0][0] --> 'a'[0] --> 'a'
Now why doesnt this list which holds integer seem to work??
l = [1,2,3]
l[0] 1
l[0][0]
Traceback (most recent call last):
File "<pyshell#244>", line 1, in -toplevel-
l[0][0]
TypeError: unsubscriptable object
l[0] 1
1[0]
Traceback (most recent call last):
File "<pyshell#246>", line 1, in -toplevel-
1[0]
TypeError: unsubscriptable object
The compiler reports unsubscriptable object ?? confused , dazzled i am ???!!??
The same list now holds integer instead of strings and l[0][0][0]
which worked fine earlier on strings doesn't seem to work on
integers???
Any help is greatly appreciated.