What is a Tuple in Python?

A Tuple is one of the four built-in data types in Python. Lists, Sets, and Dictionaries are the other three data types. When utilized, each data type has its own set of advantages and disadvantages.

A Python tuple has the following properties:

  • Tuples are data sets that are organized and indexed. The first item in the tuple will have the index [0], the second value will have the index [1,], and so forth.

  • Multiple values can be stored in tuples.

  • The values of a tuple cannot be modified after they have been allocated to it.

  • Tuples enable you to store various data objects in a single variable. One can store only one type of data in a tuple or combine multiple as needed.

How is Tuple created?
Tuples are created using ( )

Example

thistuple = ("Pune", "Mumbai", "Hyderabad")
print(thistuple)

Output

tuple