How to declare, initialize and print Jagged list (list of uneven sub lists) of integers in Python

1 Answer

0 votes
jagged = [[1, 2, 3], [7, 9, 12, 5, 88, 100]]

for sub_list in jagged:
    print(len(sub_list), sub_list)

'''
run:

3 [1, 2, 3]
6 [7, 9, 12, 5, 88, 100]

'''

 



answered Mar 4, 2016 by avibootz
...