How to iterate over list of lists in Python

2 Answers

0 votes
list_of_lists = [['python', 45, 937],
                 [7, 'java', 3.14],
                 ['c++', True, 'c']]

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


     
 
'''
run:
 
['python', 45, 937]
[7, 'java', 3.14]
['c++', True, 'c']

'''

 



answered Jan 11, 2021 by avibootz
0 votes
list_of_lists = [['python', 45, 937],
                 [7, 'java', 3.14],
                 ['c++', True, 'c']]

for lst in list_of_lists:
    print(lst)


     
 
'''
run:
 
['python', 45, 937]
[7, 'java', 3.14]
['c++', True, 'c']

'''

 



answered Jan 11, 2021 by avibootz

Related questions

2 answers 219 views
1 answer 178 views
3 answers 178 views
1 answer 120 views
1 answer 173 views
1 answer 174 views
1 answer 140 views
...