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 197 views
1 answer 165 views
3 answers 161 views
1 answer 110 views
1 answer 164 views
1 answer 165 views
1 answer 132 views
...