Explanation
List x:
Slicing: x[1:-1]
1 is the start index → starts from index 1 → value 2
-1 is the end index (exclusive) → goes up to index -1 → value 5, but not included
So, you're slicing from index 1 up to but not including index -1.
So the slice is:
✅ Output:


0 Comments:
Post a Comment