[Tutor] Question about list

Hoffmann oasf2004 at yahoo.com
Tue Apr 11 00:29:23 CEST 2006


Hello,

I have a list: list1 =  [ 'spam!', 2, ['Ted', 'Rock']
]
and I wrote the script below:

i = 0
while i < len(list1):
    print list1[i]
    i += 1

Ok. This script will generate as the output each
element of the original list, one per line:

spam!
2
['Ted', 'Rock']

I also would like to print the length of each element
of that list:

spam! = 1 element
2 = 1 element
['Ted', 'Rock'] = 2 elements

Could anyone, please, give me some hints?
Thanks,
Hoffmann
    

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Tutor mailing list