Question Detail

COS 102 Advanced Text Processing Objective Question

Question

Which Python slicing shortcut starts from index 0 and extracts characters up to a specified stop index?
Options
A [:stop]
Correct Answer
B [start:]
C [:]
D [-stop:]
Correct Answer

Option A is the correct answer.

Detailed Explanation

The document states: 'Omit Start ([:stop]): Starts from index 0.' This shortcut allows specifying only the stop boundary, with the start defaulting to 0.

Hint

Look for the shortcut that has a blank space before the colon.

Question Info