Post

@PythonPr Answer: B) [2, 4]
The expression x[start:stop:step] returns a new list containing elements from the original list x starting at index start, up to but not including index stop, with an interval of step between elements.
Here's a breakdown:
x is the list [1, 2, 3, 4, 5]. The
English

@PythonPr B) [2,4]. x[1:4:2] starts at index 1 (2), skips every 2 steps, reaches index 3 (4), stops before index 4.
English

@PythonPr Answer is [2, 4]. Slice takes elements from index 1 to 4, and step 2 picks every second value.
English

@PythonPr Going with [2, 4] ✅
Slice breakdown: start=1 → 2, stop=4 (exclusive), step=2 → pick index 1 and 3 only → [2, 4].
English

@PythonPr B is the right answer.
This is list called list slicing x[start:end:step_size] . List slicing always create a new list.
English

















