Question

You have a Python list of fruits and want to extract a specific sub-list using slicing.  Complete the missing part of the code to obtain the sub-list `['banana', 'cherry']`. fruits = ['apple', 'banana', 'cherry', 'date', 'elderberry'] # Extract the sub-list ['banana', 'cherry'] selected_fruits = fruits[___] print(selected_fruits) Which of the following options correctly completes the code to produce `['banana', 'cherry']`?

A `1:3`
B `1:2`
C `2:4`
D `0:2`
Practice Next

Hey! Ask a query