List:
arr[1:4:2] — What it means:
This is list slicing using the format:
-
Start = 1 → Start at index 1 (2)
-
Stop = 4 → Stop before index 4 (so last included is index 3)
-
Step = 2 → Take every 2nd element
✅ Slicing Steps:
-
Start at index 1 → value is 2
-
Next step: skip 1 and move to index 3 → value is 4
-
Index 5 would be next, but stop is at 4 → stop slicing
๐น Final result:
✅ Output:


0 Comments:
Post a Comment