xxxxxxxxxx
A list method to extract only a portion of the list.
In Python, we perform slicing using the following syntax: [start: end]
fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]
sliced_fruits = fruits[1:3]
print(sliced_fruits)
# ["Orange", "Lemon"]
Javascript .slice()
const fruits= ["Banana", "Orange", "Lemon", "Apple", "Mango"]
const slicedFruits = fruits.slice(1, 3)
console.log(slicedFruits)
# ["Orange", "Lemon"]