list1 = [10, 20, [300, 400, [5000, 6000], 500], 30, 40]
-
i’ve needed to add element "7000" after the [6000]
-
also how to show the index of the value of 40
>Solution :
Use list.insert and list.index
list1 = [10, 20, [300, 400, [5000, 6000], 500], 30, 40]
print(list1)
list1[2][2].insert(2, 7000)
print(list1)
print(list1.index(40))
[10, 20, [300, 400, [5000, 6000], 500], 30, 40]
[10, 20, [300, 400, [5000, 6000, 7000], 500], 30, 40]
4