Python Tutorial

Tuples in Python Explained With Examples

Table of Contents

  • What are Tuples in Python?
  • Characteristics of Python Tuples

What are Tuples in Python?

Python tuples are immutable. This implies that they can't be changed, added to, or removed after they've been created. There are, however, a few workarounds.

The use of tuples in Python is to save more than one item in a single variable. It is a kind of data type that allows data storage. Another important thing to know about Python tuples is that you need to write these with round brackets.

Understanding Tuple Items in Python

Python tuple items can’t be changed, but you can use duplicate values. The items are stored in an order. Every item has its index. For instance, the first one will have an index of [0], the second one will have an index of [2], and so on. 

Characteristics of Python Tuples

  • Unchangeable

As mentioned above, the tuples in Python are unchangeable. It means once you have created a tuple, you can’t change it. Moreover, you can’t add new items or remove existing items from the tuple.

  • Ordered

Another characteristic of tuples is that they are ordered. What it shows is that the items in a tuple are stored in a specific order. Once you have stored the item, you can’t change the order. 

  • Duplicate Values Allowed

You can’t change the tuple items or their orders. However, the tuples allow you to add items with duplicate values.

Did you find this article helpful?