What is List in Python?
List is a kind of data structure in Python which is mutable, changeable, ordered sequence. Every value that is inside a list is called an item. Lists are defined by having value between square brackets .
age = [21, 19, 24, 25] print(type(age))
What is Tupel in Python?
Tuples are used to store multiple items in a single variable. Tuple is a kind of data structure in Python which is immutable, unchangeable. Every value that is inside a list is called an item. Tuples are defined by having value between parenthesis bracket().
city = ('London', 'Paris', 'New York', 'Los Angeles') print(type(city))
|Lists are Mutable, Changeable.||Tuples are Immutable, Unchangeable.|
|The list is better for performing operations, such as insertion and deletion.||Tuple data type is appropriate for accessing the elements.|
|Implication of iterations is Time-consuming.||The implication of iterations is coparatively Faster.|
|Lists consume more memory.||Tuple consume less memory as compared to the list.|
A loop is used for iterate the sequence. It is used to iterate List, String, Dictionary, Tuple. Iterating over a sequence is called traversal.