๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-list-slicing
Python List Slicing - GeeksforGeeks
Example 2: In this example, we use a negative step (-1) to traverse the list in reverse order and create a reversed copy. ... Explanation: slice a[::-1] starts from the end of the list and moves backward one element at a time, returning a reversed copy of the list.
Published: July 16, 2026
๐ŸŒ
Python Morsels
pythonmorsels.com โ€บ slicing
Python list slicing (with examples) - Python Morsels
August 3, 2026 - In Python, slicing uses colons in square brackets to grab part of a list, string, or tuple: first items, last items, reverse, and step.
Discussions

How to slice a list in Python - Stack Overflow
Suppose I have a list with X elements [4,76,2,8,6,4,3,7,2,1...] I'd like the first 5 elements. Unless it has less than 5 elements. [4,76,2,8,6] How to do that? More on stackoverflow.com
๐ŸŒ stackoverflow.com
Slicing list of lists in Python - Stack Overflow
This is very clear. For every sublist in A, give me the list of the first three elements. ... Save this answer. ... Show activity on this post. With numpy it is very simple - you could just perform the slice: More on stackoverflow.com
๐ŸŒ stackoverflow.com
A Comprehensive Guide to Slicing in Python
The start/end indexing when going in reverse has always taken a level of extra mental effort that I don't like. Like excluding the first and last item using [1:-1] is intuitive to me, but doing the same in reverse by doing [-2:0:-1] annoys me (though I do get why its like that). That is why I tend to do [1:-1][::-1] instead. More on reddit.com
๐ŸŒ r/Python
40
356
February 1, 2022
List slicing with negative index
On negative step, the default start and stop are reversed. Start is len-1 stop is 0. More on reddit.com
๐ŸŒ r/learnpython
5
2
December 15, 2021
People also ask

Does slicing a Python list create a copy?
Yes. Reading a list slice creates a new list containing references to the selected items. It is a shallow copy, so nested mutable objects are still shared.
๐ŸŒ
boot.dev
boot.dev โ€บ blog โ€บ python โ€บ python list slicing: syntax, examples, and a visualizer
Python List Slicing: Syntax, Examples, and a Visualizer | Boot.dev
Can Python list slices go out of range?
Yes. Python clamps slice bounds to the list instead of raising an IndexError. A slice that starts beyond the end returns an empty list.
๐ŸŒ
boot.dev
boot.dev โ€บ blog โ€บ python โ€บ python list slicing: syntax, examples, and a visualizer
Python List Slicing: Syntax, Examples, and a Visualizer | Boot.dev
Is the stop index inclusive in Python list slicing?
No. The start index is included, but the stop index is excluded. A slice from index 1 to index 4 returns the items at indexes 1, 2, and 3.
๐ŸŒ
boot.dev
boot.dev โ€บ blog โ€บ python โ€บ python list slicing: syntax, examples, and a visualizer
Python List Slicing: Syntax, Examples, and a Visualizer | Boot.dev
๐ŸŒ
Railsware
railsware.com โ€บ home โ€บ engineering โ€บ indexing and slicing for lists, tuples, strings, other sequential types in python
Python Indexing and Slicing for Lists, Tuples, Strings, other Sequential Types | Railsware Blog
September 28, 2026 - In short, slicing is a flexible tool to build new lists out of an existing list. Python supports slice notation for any sequential data type like lists, strings, tuples, bytes, bytearrays, and ranges.
๐ŸŒ
Kansas State University
textbooks.cs.ksu.edu โ€บ intro-python โ€บ 07-lists โ€บ 05-slicing-lists
Slicing Lists :: Introduction to Python
July 30, 2026 - Resources Slides One of the coolest features in Python is the ability to easily create slices of lists. A slice is simply a portion of a list that can be stored and used as a separate list, allowing us as programmers to quickly create and manipulate new lists based on existing lists.
๐ŸŒ
Python Tutorial
pythontutorial.net โ€บ home โ€บ python basics โ€บ python list slice
Python List Slice
September 4, 2026 - The begin, end, and step can be positive or negative. Positive values slice the list from the first element to the last element while negative values slice the list from the last element to the first element.
๐ŸŒ
University of Pittsburgh
sites.pitt.edu โ€บ ~naraehan โ€บ python3 โ€บ mbb8.html
Python 3 Notes: List Slicing
Python 3 Notes [ HOME | LING 1330/2330 ] Tutorial 8: List Slicing << Previous Tutorial Next Tutorial >> On this page: slice indexing with [:], negative indexing, slice and negative indexing on strings. Video Tutorial Python 3 Changes print(x,y) instead of print x, y Python 2 vs.
Find elsewhere
๐ŸŒ
Learn By Example
learnbyexample.org โ€บ python-list-slicing
Python List Slicing - Learn By Example
June 20, 2024 - In this example, we start at index 2, which corresponds to the letter โ€˜cโ€™. Then we slice up to, but not including, index 7. This means we stop just before the letter โ€˜hโ€™ at index 7. The result is a new list that contains the elements at indices 2 through 6, giving us the desired sequence of letters from โ€˜cโ€™ to โ€˜gโ€™. When slicing lists in Python, you can use negative indices as well.
๐ŸŒ
Boot.dev
boot.dev โ€บ blog โ€บ python โ€บ python list slicing: syntax, examples, and a visualizer
Python List Slicing: Syntax, Examples, and a Visualizer | Boot.dev
August 25, 2026 - A normal slice returns a new list, so the original stays unchanged. Adjust start, stop, and step below. The highlighted indexes show which values Python puts in the new list.
๐ŸŒ
Replit
replit.com โ€บ home โ€บ discover โ€บ how to slice a list in python
How to slice a list in Python | Replit
The technique uses [] notation to extract list portions with concise syntax, which makes your code more efficient. In this article, you'll explore essential slicing techniques, real-world applications, and practical tips. You will also find debugging advice to help you write cleaner, more effective Python code. ... fruits = ["apple", "banana", "cherry", "date", "elderberry"] sliced_fruits = fruits[1:4] print(sliced_fruits)
๐ŸŒ
Board Infinity
boardinfinity.com โ€บ blog โ€บ list-slicing-in-python
List Slicing in Python | Board Infinity
August 13, 2025 - One option is to use the simple slicing operator, i.e. colon (:) With this operator, you can specify where to start slicing, where to stop slicing, and the step. List slicing produces a new list from an existing one.
๐ŸŒ
Python Central
pythoncentral.io โ€บ how-to-slice-listsarrays-and-tuples-in-python
How to Slice Lists/Arrays and Tuples in Python | Python Central
July 18, 2022 - There are objects in Python called slice objects and the can be used in place of the colon syntax above. ... The slice object initialization takes in 3 arguments with the last one being the optional index increment. The general method format is: slice(start, stop, increment), and it is analogous ...
๐ŸŒ
Canard Analytics
canardanalytics.com โ€บ blog โ€บ python-list-slicing
A Guide to Python List Slicing | Canard Analytics
June 8, 2022 - # list slice notation sub_list = original_list[start:stop:step] # list slice object sub_list = original_list[slice(start,stop,step)] # The two notations are equivalent
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
How to Slice a List, String, and Tuple in Python | note.nkmk.me
May 6, 2023 - Reverse a list, string, tuple in Python (reverse, reversed) You can create a slice object using the built-in slice() function.
๐ŸŒ
Pythontutor
pythontutor.net โ€บ home โ€บ python tutorial โ€บ python lists โ€บ python list slicing
Python List Slicing โ€“ Syntax, Examples and Techniques
Get help with Python programming, assignments, projects, coding exercises and debugging. ... The simplest form of list slicing specifies a starting index and a stopping index. ... The slice starts at index 1 and stops before index 4.
๐ŸŒ
ZetCode
zetcode.com โ€บ python โ€บ list-slice
Python list slice - slicing lists in Python
Python list slice tutorial shows create list slices in Python. A list slice is a portion of elements of a list.
๐ŸŒ
UC Berkeley Statistics
stat.berkeley.edu โ€บ ~spector โ€บ extension โ€บ python โ€บ notes โ€บ node29.html
List Indexing and Slicing
As well as using slicing to extract part of a list (i.e. a slice on the right hand sign of an equal sign), you can set the value of elements in a list by using a slice on the left hand side of an equal sign. In python terminology, this is because lists are mutable objects, while strings are immutable.
๐ŸŒ
Unstop
unstop.com โ€บ home โ€บ blog โ€บ python list slice | syntax, parameters & uses (+code examples)
Python List Slice | Syntax, Parameters & Uses (+Code Examples)
December 30, 2024 - Python list slice technique extracts portions of a list using indices. Its parameters list[start:stop:step], offers flexibility to select specific elements.