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

Update 50-slicing.md #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ draft: false
weight: 5
---

Slicing is a easy way to create sub-lists from larger lists. If you remember back to our exercise on data types, we can use a slice to obtain a subset of items from a `list`. Remember that a string is just a list of characters. For example:
Slicing is an easy way to create sub-lists from larger lists. If you remember back to our exercise on data types, we can use a slice to obtain a subset of items from a `list`. Remember that a string is just a list of characters. For example:

```python
>>> my_string = "Hello, world!"
Expand Down Expand Up @@ -69,4 +69,4 @@ Python slices also have a *third*, optional argument, called "step" or "stride",

{{% notice note %}}
You can use a slice to get a subset of items from any data type that maintains an order, such as a `list` or `tuple`, but not from any non-ordered data types, such as `dict` or `set`.
{{% /notice %}}
{{% /notice %}}