In Python, both list and tuple are used to store different data type items.
| Difference | List | Tuple |
|---|---|---|
| Mutability | The list is mutable. Mutable means once you create any list in Python, then you can modify that list (add, remove or update the list items). |
The tuple is immutable. Immutable means once you create any tuple in Python, then you can not modify that tuple (adding, removing or updating the tuple items is not possible). |
| Syntax | To create a list in Python, use the square ([]) brackets. |
To create a tuple in Python, use the parenthesis (()). |
| Speed | Python list iteration is time-consuming. | Python tuple iteration is comparatively faster than the list. |
| Memory | Python list consume more memory. | Python tuple consume less memory than a list. |
| Example |
|
|