Similar to Python lists, tuples are another standard data type that allows you to store values in a sequence. They might be useful in situations where you might want to share the data with someone but not allow them to manipulate the data. They can however use the data values, but no change is reflected in the original data shared.
In this tutorial, you will see Python tuples in detail:

Be sure to check out DataCamp's Data Types for Data Science course, where you can consolidate and practice your knowledge of data structures such as lists, dictionaries, sets, and many more! Alternatively, also check out this Python Data Structures Tutorial, where you can learn more about the different data structures that Python uses.
Python Tuple
As you already read above, you can use this Python data structure to store a sequence of items that is immutable (or unchangeable) and ordered.
Tuples are initialized with () brackets rather than [] brackets as with lists. That means that, to create one, you simply have to do the following:
cake = ('c','a','k','e')
print(type(cake))
Remember that the type() is a built-in function that allows you to check the data type of the parameter passed to it.
Tuples can hold both homogeneous as well as heterogeneous values. However, remember that once you declared those values, you cannot change them:
mixed_type = ('C',0,0,'K','I','E')
for i in mixed_type:
print(i,":",type
Similar to Python lists, tuples are another standard data type that allows you to store values in a sequence. They might be useful in situations where you might want to share the data with someone but not allow them to manipulate the data. They can however use the data values, but no change is reflected in the original data shared.
In this tutorial, you will see Python tuples in detail:
Be sure to check out DataCamp's Data Types for Data Science course, where you can consolidate and practice your knowledge of data structures such as lists, dictionaries, sets, and many more! Alternatively, also check out this Python Data Structures Tutorial, where you can learn more about the different data structures that Python uses.
Python Tuple
As you already read above, you can use this Python data structure to store a sequence of items that is immutable (or unchangeable) and ordered.
Tuples are initialized with
()brackets rather than[]brackets as with lists. That means that, to create one, you simply have to do the following:Remember that the
type()is a built-in function that allows you to check the data type of the parameter passed to it.Tuples can hold both homogeneous as well as heterogeneous values. However, remember that once you declared those values, you cannot change them: