List and Tuple in Python are the class of data structure. The list is dynamic, whereas tuple has static characteristics.
List are just like the arrays, declared in other languages. Lists need not be homogeneous always which makes it a most powerful tool in Python. In Python, the list is a type of container in Data Structures, which is used to store multiple data at the same time. Lists are a useful tool for preserving a sequence of data and further iterating over it.
list_data = ['an', 'example', 'of', 'a', 'list']
Tuple is also a sequence data type that can contain elements of different data types, but these are immutable in nature. In other words, a tuple is a collection of Python objects separated by commas. The tuple is faster than the list because of static in nature.
tuple_data = ('this', 'is', 'an', 'example', 'of', 'tuple')
Difference Between List and Tuple in Python:
|1||Lists are mutable||Tuple are immutable|
|2||Implication of iterations is Time-consuming||Implication of iterations is comparatively Faster|
|3||The list is better for performing operations, such as insertion and deletion.||Tuple data type is appropriate for accessing the elements|
|4||Lists consume more memory||Tuple consume less memory as compared to the list|
|5||Lists have several built-in methods||Tuple does no have must built-in methods.|
|6||The unexpected changes and errors are more likely to occur||In tuple, it is hard to take place.|
- Python | Sort tuple list by Nth element of tuple
- Python - Flatten tuple of List to tuple
- Python - Convert Tuple Matrix to Tuple List
- Python | Replace tuple according to Nth tuple element
- Python - Raise elements of tuple as power to another tuple
- Python - Convert Tuple String to Integer Tuple
- Python - Convert Tuple to Tuple Pair
- Difference between List VS Set VS Tuple in Python
- Python | Pair and combine nested list to tuple list
- Python program to create a list of tuples from given list having number and its cube in each tuple
- Python | Merge list of tuple into list by joining the strings
- Python | Convert list to indexed tuple list
- Python | Convert Integral list to tuple list
- Python | Convert mixed data types tuple list to string list
- Python | Convert List of Dictionary to Tuple list
- Python - Convert Tuple value list to List of tuples
- Python program to convert a list of strings with a delimiter to a list of tuple
- Python | Sort tuple list on basis of difference of elements
- Python - Consecutive Kth column Difference in Tuple List
- Python | Find Maximum difference between tuple pairs
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.