0Pricing
Learn AI with Python · Lesson

Tuples

Understand the benefits of immutable sequences and how to use them.

1

Introduction to Tuples

Tuples are immutable sequences in Python, meaning their elements cannot be changed after creation. They are often used to group related data.

In this lesson, you’ll learn how to create and use tuples, perform operations on them, and understand their immutability.

Tuples — illustration 1

2

Creating Tuples

A tuple is created by placing elements inside parentheses (), separated by commas:

# Creating a tuple
fruits = ("apple", "banana", "cherry")
print(fruits)

All lessons in this course

  1. Lists
  2. Tuples
  3. Sets
  4. Dictionaries
  5. Strings as Data Structures
← Back to Learn AI with Python