Post

@PythonPr (a) [2, 3]
Understand that;
Python uses zero-based indexing and negative indexing for lists, where:
Positive indices start from 0 at the beginning of the list.
Negative indices start from -1 at the end of the list.
For the given list nums = [1, 2, 3, 4]:
1 is at index 0 (or -4)
English

@PythonPr Answer: A) [2, 3]
Explanation:
Negative slicing counts from the end.
-3 points to 2, -1 points to 4 (exclusive), so the slice includes elements at indices 1 and 2 → [2, 3].
English

@PythonPr Answer: A
Solution: This is an application of slicing and negative indices.
You must be familiar with the usual indexing that starts from 0 (starting from the left).
Negative indexing is a cool feature of python. It allows you to count backwards (from the right).
Eg
+
English

@PythonPr The slice includes everything from index -3 up to, but not including, index -1. This leaves the elements [2, 3].
Answer=A
English

@PythonPr A
Starts at 2(-3) ; ends at 3(-1) excluding 4
English
















