For Statements : List Loop « List « Python






For Statements

For Statements

a = ['cat', 'window', 'defenestrate']
for x in a:
     print x, len(x)


           
       








Related examples in the same category

1.List for iterationList for iteration
2.Loop through a list: for inLoop through a list: for in
3.To iterate over the indices of a sequence, combine range() and len()To iterate over the indices of a sequence, combine range() and len()
4.For loop demoFor loop demo
5.For loop for ListFor loop for List