Course Content
NumPy in a Nutshell
NumPy in a Nutshell
Get One Dimensional Array Using Slice and Only Positive Indexes
Let's examine the syntax of slicing: array[start:end:step]
, where:
start
is the index from which the slicing begins;end
is the index at which the slicing concludes (note that this index is not included);step
is the parameter that specifies the intervals between the indices.
Task
Consider the following array: [11, 5, 87, 1, 44, 11, 6, 0, -5]
.
You need to obtain the following array: [87, 11, -5]
.
Use a slice with ONLY NON-NEGATIVE start
, end
, and step
values.
Thanks for your feedback!
Get One Dimensional Array Using Slice and Only Positive Indexes
Let's examine the syntax of slicing: array[start:end:step]
, where:
start
is the index from which the slicing begins;end
is the index at which the slicing concludes (note that this index is not included);step
is the parameter that specifies the intervals between the indices.
Task
Consider the following array: [11, 5, 87, 1, 44, 11, 6, 0, -5]
.
You need to obtain the following array: [87, 11, -5]
.
Use a slice with ONLY NON-NEGATIVE start
, end
, and step
values.
Thanks for your feedback!
Get One Dimensional Array Using Slice and Only Positive Indexes
Let's examine the syntax of slicing: array[start:end:step]
, where:
start
is the index from which the slicing begins;end
is the index at which the slicing concludes (note that this index is not included);step
is the parameter that specifies the intervals between the indices.
Task
Consider the following array: [11, 5, 87, 1, 44, 11, 6, 0, -5]
.
You need to obtain the following array: [87, 11, -5]
.
Use a slice with ONLY NON-NEGATIVE start
, end
, and step
values.
Thanks for your feedback!
Let's examine the syntax of slicing: array[start:end:step]
, where:
start
is the index from which the slicing begins;end
is the index at which the slicing concludes (note that this index is not included);step
is the parameter that specifies the intervals between the indices.
Task
Consider the following array: [11, 5, 87, 1, 44, 11, 6, 0, -5]
.
You need to obtain the following array: [87, 11, -5]
.
Use a slice with ONLY NON-NEGATIVE start
, end
, and step
values.