Unit: Unit 4: Strings, Lists, and Tuples • Interactive Practice
Interactive Python programming tutorial and practice in your browser.
# Insert items at chosen index positions in the inventory list
inventory = ["laptop", "wireless mouse", "mechanical keyboard"]
# 1. Insert "docking station" at the very beginning (index 0)
inventory.insert(0, "docking station")
# 2. Insert "mousepad" between "wireless mouse" and "mechanical keyboard" (at index 2)
inventory.insert(2, "mousepad")
print("Inventory after insertions:", inventory)