Question: Selecting single values from a list is just one part of the story. It's also possible to slice your list, which means selecting multiple elements
Selecting single values from a list is just one part of the story. It's also possible to slice your list, which means selecting multiple elements from your list. Use the following syntax:
myliststart:end
The start index will be included, while the end index is not.
The code sample below shows an example. A list with b and c corresponding to indexes and are selected from a list x:
x abcd
x:
The elements with index and are included, while the element with index is not.
Instructions
XP
Use slicing to create a list, downstairs, that contains the first elements of areas.
Do a similar thing to create a new variable, upstairs, that contains the last elements of areas.
Print both downstairs and upstairs using print
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
