Python Programming Language Tuples Tutorial

Jesse L
4 min readAug 17, 2021

Hi everyone, welcome back. In this tutorial, I will show how to perform basic tasks involving tuples in Python. A tuple is a data structure in the Python language and it is capable of storing several items in a singular tuple variable. Tuples are a built in data type in Python. We will go over tuple related functions and how tuples can be manipulated in this tutorial.

Tuples

We can create an empty tuple by using parenthesis:

tuple = ()

We can create a tuple and populate it by adding values within the parenthesis:

tuple = ("item1", "item2", "item3")

As you can see, I added three string items into my tuple and each item in my tuple is separated by a comma. We can print our tuple to see what it looks like:

tuple = ("item1", "item2", "item3")
print(tuple)
Output
('item1', 'item2', 'item3')

Python has 4 different basic built in data structures. They are lists, tuples, dictionaries, and sets. Each one has different uses for different situations. Tuples are immutable, ordered, and allows duplicate values.

How do you get values from within a tuple? A tuple uses indexing which allows us to refer to items by index number. Take note that the first…

--

--

Jesse L

Hi, I'm a passionate technology enthusiast and lifelong learner. Beyond my technical pursuits, I'm also passionate about sharing my enthusiasm with others.