📚 › Python: the friendliest first language
6. Slicing lists
इस लेख का अनुवाद अपने आप होगा। अभी अंग्रेज़ी में दिखाया जा रहा है।
A slice takes part of a list: items[1:3] gives items at positions 1 and 2, because the end is not included. items[:2] starts at the beginning, and items[-1] is the last item.
Slicing never changes the original list.
उदाहरण देखें
letters = ["a", "b", "c", "d"]
print(letters[1:3])
print(letters[-1])
✍️ अब आपकी बारी
From [10, 20, 30, 40, 50], print the middle three items as a list.