total = 0 lst = [[20, 12, 1, 5], [25, 10, 7], [9, 30]] for i in range(len(lst)): for j in range(len(lst[i])): total += lst[i][j]