4.2.1 Creating Lists

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):

# Create lists using literal syntax [] and constructor list()
inventory = ["laptop", "mouse", "keyboard"]
empty_cart = []
digits = list(range(1, 6))

print("Inventory:", inventory)
print("Empty cart:", empty_cart)
print("Digits:", digits)
Open in Live Interactive Python Sandbox →