How to add value into sub-list

Question:

Looking for a way to add value 555 right after 6000 to make it and display it.

mylist = [4, 11, [300, 400, [5000, 6000, 555], 500], 30, 40]

Original list below.

mylist = [4, 11, [300, 400, [5000, 6000], 500], 30, 40]
Asked By: Chloe

||

Answers:

Can you try adding append to corresponding index
mylist[2][2].append(555)

Answered By: Prathap Parameswar
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.