Elektrine lite

← Feed

@hwine@vmst.io

Post #2633339

2026-05-07 03:57 UTC

@Blujean@mas.to @davidruffner@raphus.social Yeah, slices take a bit of getting used to. It helps me to thing of the first 2 values as "start" and "stop_before". So `a[1:1]` is not an element of the array, it's the space between elements 0 & 1. (slice starting at 1 and ending before 1) ``` a = [0, 1, 2, 3] print(a[1:1]) # [] print(a[:1], a[1:]) # [0] [1, 2, 3] ```

Replies (0)

No replies.