The data type list allows manipulation of its contents through various operations concatenation, repetition, membership and slicing.
Concatenation
Python allows us to join two or more lists using the concatenation operator depicted by the symbol ‘+’.
Lists l1 and l2 remain the same after the concatenation operation.
Repetition
Python allows us to replicate a list using repetition operator depicted by symbol *.
Membership
In operator
The membership operator ‘in’ checks if the element is present in the list and returns True, else returns False.
Not in operator
The not in operator returns True if the element is not present in the list, else it returns False.
Slicing
In Python, to access some part of a list , we use a method called slicing. This can be done by specifying an index range.
Syntax:
List[ Initial : End : IndexJump ]