Nested list adding element

Hi
PLease suggest a way to solve below problem. I tried a lot but was not able to do it

Hello @miniamisha, this is how I solved it:
list1 = [10, 20, [300, 400, [5000, 6000], 500], 30, 40]
list1[2][2].append(7000)
list1

Explanation:
7000 should be appended in the list [5000, 6000], so list1[2][2] is the index of that particular list then we use append() function to add 7000 to that list.

I hope it makes sense to you now :blush:

3 Likes