list slicing in python 1

list slicing in python

# List slicing
friends = ["Harry", "Tom", "Rohan", "Sam", "Divya", 45]

Here is what the above code is Doing:
1. friends[0:4] -> This means from the 0th index to the 4th index.
2. friends[-4:] -> This means from the 4th last index to the last index.

Similar Posts