How to represent a triangle in a list of lists with Python

1 Answer

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

for item in list_of_lists:
    print(item[0], ' '.join(map(str, item[1:])))



'''
run:

8 
2 4
5 3 1
0 7 6 9

'''

 



answered Jun 7, 2024 by avibootz
...