Skip to content

Add illustration for visual intuition of indexing and slicing#1118

Open
unode wants to merge 1 commit intoswcarpentry:mainfrom
unode:visual-index-vs-slice
Open

Add illustration for visual intuition of indexing and slicing#1118
unode wants to merge 1 commit intoswcarpentry:mainfrom
unode:visual-index-vs-slice

Conversation

@unode
Copy link
Copy Markdown
Contributor

@unode unode commented Apr 28, 2026

This illustration has been used to help beginners understand why the last digit of a slice doesn't imply including another element.

The intuition makes a distinction between indexing, the number of the position, and slicing, the number of the gap between elements.

For step based slices, the alternative intuition is to create rows with the values and keeping only the first row.

@tobyhodges

python_indexing_slicing

This illustration has been used to help beginners understand why the
last digit of a slice doesn't imply including another element.

The intuition makes a distinction between indexing, the number of the position,
and slicing, the number of the gap between elements.

For step based slices, the alternative intuition is to create rows with
the values and keeping only the first row.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Thank you!

Thank you for your pull request 😃

🤖 This automated message can help you check the rendered files in your submission for clarity. If you have any questions, please feel free to open an issue in {sandpaper}.

If you have files that automatically render output (e.g. R Markdown), then you should check for the following:

  • 🎯 correct output
  • 🖼️ correct figures
  • ❓ new warnings
  • ‼️ new errors

Rendered Changes

🔍 Inspect the changes: https://github.com/swcarpentry/python-novice-inflammation/compare/md-outputs..md-outputs-PR-1118

The following changes were observed in the rendered markdown documents:

 04-lists.md                           |    3 +
 fig/python_indexing_slicing.svg (new) | 1092 +++++++++++++++++++++++++++++++++
 md5sum.txt                            |    2 +-
 3 files changed, 1096 insertions(+), 1 deletion(-)
What does this mean?

If you have source files that require output and figures to be generated (e.g. R Markdown), then it is important to make sure the generated figures and output are reproducible.

This output provides a way for you to inspect the output in a diff-friendly manner so that it's easy to see the changes that occur due to new software versions or randomisation.

⏱️ Updated at 2026-04-28 14:26:38 +0000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant