Learn Before
slicing the list from i to j ( i and j are integers )
- Syntax :
my_list[i:j]
-
Slicing the list from i to j provide elements in the list with index k such that i <= k < j .
-
If i or j is greater than length of the list then length of the list is taken.
-
If i is not mentioned or None, 0 is used.
-
If j is not mentioned or None, length of the list is used.
-
The sliced list will be empty if i is greater than or equal to j.
The examples shown below work with list named my_list containing the following items/elements 1, '1cademy', 12.59, True.

0
0
Tags
Python Programming Language
Data Science
Related
'in' operator
'not in' operator
'*' ( repetition ) operator
'+' ( concatenation ) operator
slicing the list from i to j ( i and j are integers )
indexing i th item of a list
slicing with a step
length of a list which is passed as the argument of the function len()
min() ( smallest item in the list )
max() ( largest item in the list )
index of an element in the list at or after an index and before another index
count ( total number of occurrences of a particular element in the list )