---
title: "What is meant by tuple in python?Give suitable example."  
description: "What is meant by tuple in python?Give suitable example."  
author: "Amrita Bhattacharjee"  
published: 2023-03-28  
updated: 2023-04-19  
canonical: https://www.mindstick.com/forum/157621/what-is-meant-by-tuple-in-python-give-suitable-example  
category: "python"  
tags: ["python"]  
reading_time: 2 minutes  

---

# What is meant by tuple in python?Give suitable example.

What is meant by [tuple](https://www.mindstick.com/forum/33652/how-to-use-tuple-in-c-sharp) in [python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python)?Give suitable example.

## Replies

### Reply by Aryan Kumar

In Python, a tuple is a collection of ordered, immutable elements. Tuples are similar to lists in Python, but the main difference is that tuples cannot be modified once they are created. Tuples are often used to store related data together and can be indexed and iterated like lists.

Tuples are often used to return multiple values from a function, since they allow for easy grouping of related data. However, since tuples are immutable, elements cannot be modified once the tuple is created.

A tuple is created using parentheses (), and elements are separated by commas. Here's an example of a tuple:

```python
my_tuple = (1, 2, 3, "four", "five")
```

### Reply by Krishnapriya Rajeev

Tuples are one of the 4 built-in data types in Python used to store connections of data. These are used to store multiple items of the same or different data types in a single variable.\
Tuples are ordered, immutable, and allow duplicate values.

```plaintext
tuple1 = ("Delhi", "Mumbai", "Chennai", 9)
```

Tuples are ordered, hence tuple items can be indexed:

```plaintext
print (tuple1[1])
# Output = Mumbai
```

We can use len() function to find the length of the tuple:

```plaintext
print(len(tuple1))
# Output = 4
```

Since tuples are immutable, we cannot add, insert, update, or delete items from a tuple.

To create a type with only one item, we need to add a comma after the item; otherwise, it won't be recognized as a tuple:

```plaintext
tuple2 = ("Hello",)       # This is a tuple
tuple3 = ("Hello")        # This is a string
```


---

Original Source: https://www.mindstick.com/forum/157621/what-is-meant-by-tuple-in-python-give-suitable-example

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
