How to count items in list of lists with Python

1 Answer

0 votes
lst_lst = [[1, 2, 3] ,[4, 5, 6], [7, 8, 9]]

count = 0
for e in lst_lst:
    count += len(e)         
    
print('Total Number of elements: ', count)


  
  
  
'''
run:
  
Total Number of elements:  9

'''

 



answered Jul 24, 2022 by avibootz
...