Next →

What is a Tuple?

A tuple is similar to a list, but it is immutable — meaning once created, it cannot be changed (no adding, removing, or modifying items).

Tuples are defined using parentheses:

point = (10, 20)

Why Use Tuples?

Tuples are useful when you want to store a fixed set of values that should not be altered. They can also be faster and safer in some cases.

Accessing Tuple Items

Just like lists, you can access tuple elements by index:

point[0] # returns 10
point[1] # returns 20