Skip to content

What is a tuple in Python | Basics

  • by

Tuples are store multiple items in a single variable in Python. A tuple is an immutable object meaning that we cannot change, add or remove items after the tuple has been created.

empty_tuple = ()
mytuple = ("apple", "banana", "cherry")

Python Tuples are used to store collections of data, and their other data type is List, Set, and Dictionary, all with different qualities and usage.

How to create and use tuple in Python

Simple example code creating non-empty tuples. Tuples that are ordered will not change, unchangeable and Allow Duplicates.

# One way of creation
tup = 'A', 'B'

# Another for doing the same
tup = ('X', 'Y')


What is a tuple in Python

Do comment if you have any doubts and suggestions on this Python tuple basics tutorial.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.