📦 Lesson 6: Data & Lists

In this lesson, you'll learn about Python's list data structure — one of the most powerful tools in your programming toolbox.

🔍 What is a List?

A list is a collection of items. You can store numbers, strings, or even other lists in a list. Lists are created using square brackets [].

fruits = ["apple", "banana", "cherry"]
print(fruits[0])  # apple
print(fruits[1])  # banana

🛠 Common List Operations

numbers = [1, 2, 3]
numbers.append(4)      # [1, 2, 3, 4]
numbers.remove(2)      # [1, 3, 4]
print(numbers[1])      # 3
print(numbers[-1])     # 4
print(numbers[:2])     # [1, 3]

🔁 Looping Through a List

for fruit in fruits:
    print("I like", fruit)

💡 Mini Challenges

📘 Assignment

Create a Python program that asks the user to enter 3 of their favorite foods. Store them in a list and print a menu using that list.

← Back to Dashboard