In Python, Tuple and List are built-in data structures.
Some of the differences between Tuple and List are as follows:
- Syntax: A Tuple is enclosed in parentheses:
E.g. myTuple = (10, 20, “apple”);
A List is enclosed in brackets:
E.g. myList = [10, 20, 30];
- Mutable: Tuple is an immutable data structure. Whereas, a List is a mutable data structure.
- Size: A Tuple takes much lesser space than a List in Python.
- Performance: Tuple is faster than a List in Python. So it gives us good performance.
- Use case: Since Tuple is immutable, we can use it in cases like Dictionary creation. Whereas, a List is preferred in the use case where data can alter.