About 18,700,000 results
Open links in new tab
  1. Python Slicing – How to Slice an Array and What Does [::-1] Mean?

    Dec 8, 2022 · When you specify a start and end index of 1 and 5, respectively, slicing will select values at index 1, index 2 (1 increment to the previous index), index 3 (1 increment to the …

  2. list - what does [::-1] mean in python - slicing? - Stack Overflow

    So easy way is to omit the second parameter in slicing. That is, a[10::-1] #or a[-1::-1] # Output = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] # Which is what we want. In order to further simplify, if you omit both …

  3. Python List Slicing - GeeksforGeeks

    Mar 8, 2025 · Python list slicing is fundamental concept that let us easily access specific elements in a list. In this article, we’ll learn the syntax and how to use both positive and negative …

  4. Python List Slicing - Learn By Example

    To perform slicing, you use square brackets [] along with a special syntax. This syntax involves specifying the starting index (where your slice begins), the stopping index (where it ends), and …

  5. List slicing in Python

    Mar 8, 2024 · In Python, slicing looks like indexing with colons (:). You can slice a list (or any sequence) to get the first few items, the last few items, or all items in reverse.

  6. Python List Slicing: How to Use It [With Simple Examples]

    Oct 29, 2023 · With Python’s list slicing notation you can select a subset of a list, for example, the beginning of a list up to a specific element or the end of a list starting from a given element. …

  7. Python Slicing | Python slice() Constructor - Python Geeks

    Learn what is Python Slicing, slice constructor & its use cases. See how to use negative indexing to get objects in reverse.

  8. Python List Slice with Examples - Spark By Examples

    May 30, 2024 · For example, you can use the slice operator [1:3] to extract a subset of the list containing elements with indexes 1 and 2. From the below example it returns 'Python' and …

  9. Python Slicing in Depth - Python Tutorial

    Summary: in this tutorial, you’ll learn about Python slicing and how to use it to extract data from and assign data to a sequence. So far you’ve learned about slicing such as list slicing. …

  10. Python Slicing: 9 Useful Methods for Everyday Coding - Analytics …

    May 16, 2025 · Slicing through 1-D Arrays. import numpy as np # Create a 1-D NumPy array arr = np.array([10, 20, 30, 40, 50, 60]) # Slice from index 1 to index 4 (exclusive) print(arr[1:4]) # …

Refresh