Description

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 [].

For Example:

age = [21, 19, 24, 25]
print(type(age))

Output:

<class 'list'>

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().

For Example:

city = ('London', 'Paris', 'New York', 'Los Angeles')
print(type(city))

Output:

<class 'tuple'>

List Tuple
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.

 

Comments

Login is mandatory to comment Please login

Recommended Posts

Dictionary In Python | Method Of Dictionary

Dictionary is used to store data values in Key: Value pairs. A dictionary is a collection which is ordered, Changeable and do not allow duplicates.

Implement of All Method of String in Python Programming language

Implementation of all methods of string in python. How to implement of method on string.

Operators based Exercise 1 in Python Programming language.

All operators used for better understanding the python operators.

Sets in Python | Perform Set methods

A Set is an unordered collection data type which does not contain duplicates elements. A set is iterable and mutable data type.

Conditional Statement If elif else statement in Python

Like some situation comes in our real life in which we have to take some decision as to what we have to do next.

Everything about of Loops in Python | For loop | While loop | Nested Loop

A loop is used for iterate the sequence. It is used to iterate List, String, Dictionary, Tuple. Iterating over a sequence is called traversal.