0Pricing
Python Academy · Lesson

Creating and Accessing Lists

Build lists and access elements by index and slice.

Introduction

Lists are Python's most flexible ordered collection. They hold any mix of types and support indexing, slicing, and iteration.

Creating a List

my_list = [1, 2, 3] or empty = [] Lists are ordered and mutable. Elements can be of any type.
nums = [1, 2, 3]
mixed = [1, 'hi', True]
print(nums, mixed)

All lessons in this course

  1. Creating and Accessing Lists
  2. Modifying Lists
  3. Tuples and Immutability
  4. Nested Lists and Iteration
← Back to Python Academy