Python Archive

List operations using operators

List Operations using operators: Lists can be concatenated using + operator. List repetition is possible using * operator. “in” operator is used to test whether the element is present or not in the list. “in” …

Built In Functions – List Collection

Built in Functions of List: all() : return True if all elements of the List are true (or if the list is empty) any() : Return True if any one of List element is True. …

Nested Lists in Python

Nested Lists: Defining a List as an element inside another list. List is an object; hence we connect the nested list by storing the address. Code:

Indexing and Slicing in Nested Loops

Using index, we can access only one element at a time. Through slicing, we can access multiple elements either from list or sub list. Every element in python is an Object. An address will store …

List Mutability

List Mutability: List is Mutable Mutable object can be modified. Address remains same after modification of Mutable object In Python, Strings, Integers, Floats all elements are Immutable objects. Immutable object get another location when we …

tuple in python

tuple It is an ordered collection. It allow to store duplicates. It can stores different type of elements. We can represent the tuple with ( ) We can process elements using indexing and slicing

tuple is Immutable

Immutability: List is Mutable – can modify Modification methods are present in List object. List elements also can modify. Tuple is Immutable – Constant object. Modification methods are not present in tuple object. Only 2 …

Set in Python

Set: Set is not an ordered collection Set element will be processed randomly on access. Set can be represented by {  } We can store heterogeneous elements into set Set elements are unique. Duplicates will …

Set functionality in python

Set functionality: ‘set’ is a class. ‘set’ object providing pre-defined functions to process the elements Output: We can construct the collection of object by calling constructor. We can construct one collection object by passing another …

Set is Mutable

Mutability: Set is Mutable. Hence it is allowed to modify the set after creation. add() & discard() function in the above example explains how to modify the set after creation. Output: Set is allowed to …

Courses Enquiry Form