You can return a range of items by using the slice syntax. Specify the start index and the end index, separated by a colon, to return a part of the list.
In this blog post, you will learn how to use python list slice.
Step 1: Create a list
my_list = [1, 2, 3, 4, 5]
Step 2: Slice the list
print(my_list[2:4])
Output:
[3, 4]