diff options
| author | Divay Prakash <divayprakash@users.noreply.github.com> | 2019-09-24 10:18:22 +0530 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-24 10:18:22 +0530 | 
| commit | dff76c7965af30e7c7a752513a9ab93a15eb58bc (patch) | |
| tree | 91493f7c9b0a3e39013743af4081aa317f11bd46 | |
| parent | 7bd3a074b10bf9db57ab8d2eb45189c33ecd03ff (diff) | |
| parent | 80096795e04d66bde02535775f66224f98a7a17f (diff) | |
Merge pull request #3630 from divayprakash/fix-python
[python3/en] Fix explanation for slices, closes #3629
| -rw-r--r-- | python3.html.markdown | 14 | 
1 files changed, 5 insertions, 9 deletions
| diff --git a/python3.html.markdown b/python3.html.markdown index 4cabb27b..430927a9 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -228,15 +228,11 @@ li[4]  # Raises an IndexError  # You can look at ranges with slice syntax.  # The start index is included, the end index is not  # (It's a closed/open range for you mathy types.) -li[1:3]   # => [2, 4] -# Omit the beginning and return the list -li[2:]    # => [4, 3] -# Omit the end and return the list -li[:3]    # => [1, 2, 4] -# Select every second entry -li[::2]   # =>[1, 4] -# Return a reversed copy of the list -li[::-1]  # => [3, 4, 2, 1] +li[1:3]   # Return list from index 1 to 3 => [2, 4] +li[2:]    # Return list starting from index 2 => [4, 3] +li[:3]    # Return list from beginning uptil index 3  => [1, 2, 4] +li[::2]   # Return list selecting every second entry => [1, 4] +li[::-1]  # Return list in reverse order => [3, 4, 2, 1]  # Use any combination of these to make advanced slices  # li[start:end:step] | 
