4.2.5 Adding Elements: append()

Unit: Unit 4: Strings, Lists, and Tuples • Interactive Practice

Quick Answer & Summary:

Interactive Python programming tutorial and practice in your browser.

Interactive Challenge (Run Live in Browser):

# Grow the inventory list dynamically using append()
inventory = ["laptop", "wireless mouse", "mechanical keyboard"]

# 1. Add "monitor" to the end of the list
inventory.append("monitor")

# 2. Add "webcam" to the end of the list
inventory.append("webcam")

print("Inventory after append operations:", inventory)
print("Total items:", len(inventory))
Open in Live Interactive Python Sandbox →