Question Detail

COS 102 Advanced Text Processing Objective Question

Question

If you use the slicing shortcut `[start:]` with the string 'Python', such as `"Python"[2:]`, what will be the output?
Options
A Py
B thon
Correct Answer
C tho
D n
Correct Answer

Option B is the correct answer.

Detailed Explanation

The shortcut [start:] goes 'all the way to the end' from the start index. For "Python"[2:], it starts at index 2 ('t') and includes all characters until the end, producing 'thon'.

Hint

Consider what happens when the stop index is omitted.

Question Info