Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommendation to remove index 9 for a 9-element list #14

Open
thawn opened this issue Sep 30, 2022 · 3 comments
Open

Recommendation to remove index 9 for a 9-element list #14

thawn opened this issue Sep 30, 2022 · 3 comments

Comments

@thawn
Copy link

thawn commented Sep 30, 2022

On slides 5 - 18 and 23-24 of Python_data_structures.pdf, there is a 9-element list ("A" - "I") as an example for indexing:
Screenshot 2022-09-30 at 15 54 51
I recommend to remove the index number 9:
Screenshot 2022-09-30 at 15 54 51

@thawn
Copy link
Author

thawn commented Sep 30, 2022

I put the ppt with suggested changes on the cloud server for review.

@haesleinhuepf
Copy link
Member

Hey @thawn ,

I think we need the 9 to explain what this code does:

data[5:9]

Does this make sense?

@thawn
Copy link
Author

thawn commented Sep 30, 2022

Now I understand what you mean - thanks :)

To me, the 9 was confusing, because it gave the impression that the list of indices contains the element 9.
Also, I was puzzled for a while, which index belongs to which element.

The elegance of putting the indices in-between the elements becomes clear when thinking about range-indexing.

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

No branches or pull requests

2 participants