Can someone help me in understanding Tuple, I am new to Python and finding it difficult understand Tuple. Please help.
Mar 4, 2019 in Python 1,808 views

## 4 answers to this question.

A tuple is created in a similar way as a list but the values are included in ().

Example:

```tup3 = "a", "b", "c", "d";
tup1 = ();
```
`Access Tuple`
```tup1 = ('a', 'b', 1, 2);
tup2 = (1, 2, 3, 4, 5, 6, 7 );
print "tup1[0]: ", tup1[0];
print "tup2[1:5]: ", tup2[1:5];```

Output:

```tup1[0]: a
tup2[1:5]: [2,3,4,5]```
answered Mar 4, 2019 by
• 58,100 points

### ('rajesh', 'kumar')    ('rajesh', 'kumar')

answered Apr 12, 2019 by
• 1,270 points
it is a python sequency which stores group of elements or items. tuple are same as list the main difference is they are inmutable.

where as list is mutable.
answered Jul 18, 2019 by mounika reddy
Hey @Mounika, can you explain your answer a bit with some examples?

Tuples  are a  Unchanging sequence of values, each one accessible individually, and a tuple is a basic type in Python. You can recognize tuples when they are created because they are surrounded by ‘()’ parentheses . Tuples contain data such as strings and numbers. Open the python shell and perform the following example.

```Program:
>>> filler = ("string", "filled", "by a", "tuple")
>>> print("A %s %s %s %s" % ("string", "filled", "by a", "tuple")
A string filled by a tuple

>>> print("A %s %s %s %s" % filler)
A string filled by a tuple
```
answered Jun 21, 2020 by
• 580 points

## What is an array in Python? How to declare it?

Python doesn't have a native array data ...READ MORE

## Is there a foreach function in python and is there a way to implement it if there isnt any

Every occurence of "foreach" I've seen (PHP, ...READ MORE

## How do I use urllib to see if a website is 404 or 200 in Python?

For Python 3, try doing this: import urllib.request, ...READ MORE

## What is absolute import in Python and how is it used?

An absolute {import, path, URL} tells you exactly how ...READ MORE

## how do i change string to a list?

suppose you have a string with a ...READ MORE

## how can i randomly select items from a list?

You can also use the random library's ...READ MORE

+1 vote

## how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

## how do i use the enumerate function inside a list?

Enumerate() method adds a counter to an ...READ MORE

+1 vote