What is the length of d
? d = [1, 2, 3][1:]
. I can't understand what the [1:]
mean at the end.
Asked
Active
Viewed 703 times
2

Manu Chadha
- 15,555
- 19
- 91
- 184
1 Answers
2
It’s referred to as ‘slicing’. Examples shown here.
From element 1 (the second element) through to the end, therefore a length of 2.
Aside: You’d (hopefully) never see this exact case in real-world practice, as it’s nonsense.

S3DEV
- 8,768
- 3
- 31
- 42
-
it means we can assign number of Values in a lsit and in the same line by using slicing we can restrict to choose and store some specific value. @S3DEV – Ankit gupta Aug 08 '21 at 10:03