I wanted to add element with the next value to the most nested list, i. e.
For list
list_in = [2, 3, [4, 5, [6, 7], 6], 2, [5, 6]]
The program should return
list_out = [2, 3, [4, 5, [6, 7, 8], 6], 2, [5, 6]]
In case with e. x. two equal nests, I wanted to get:
list_in = [2, [4], [3]]
list_out = [2, [4, 5], [3, 4]]
How to do it?