Python Practice › List Programs › Program 57
Insert an item at an index
Write a Python program to insert an item at a specific position.
Input
[2, 4, 6, 8, 3, 22], index 3, item 55
Output
[2, 4, 6, 55, 8, 3, 22]
Approach
insert(index, item).
Solution
items = [2, 4, 6, 8, 3, 22]items.insert(3, 55)print(items)Output
[2, 4, 6, 55, 8, 3, 22]
Learn the concept
New to this topic? Read the lesson, then come back.