Colon (:) in Python list index
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Realization
--
Chapters
00:00 Question
00:37 Accepted answer (Score 239)
01:07 Answer 2 (Score 20)
01:20 Answer 3 (Score 12)
01:41 Thank you
--
Full question
https://stackoverflow.com/questions/4012...
Accepted answer links:
[https://youtu.be/tKTZoB2Vjuk?t=41m40s]: https://youtu.be/tKTZoB2Vjuk?
Answer 2 links:
http://docs.python.org/tutorial/introduc...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Realization
--
Chapters
00:00 Question
00:37 Accepted answer (Score 239)
01:07 Answer 2 (Score 20)
01:20 Answer 3 (Score 12)
01:41 Thank you
--
Full question
https://stackoverflow.com/questions/4012...
Accepted answer links:
[https://youtu.be/tKTZoB2Vjuk?t=41m40s]: https://youtu.be/tKTZoB2Vjuk?
Answer 2 links:
http://docs.python.org/tutorial/introduc...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python
#avk47
ACCEPTED ANSWER
Score 247
: is the delimiter of the slice syntax to 'slice out' sub-parts in sequences , [start:end]
[1:5] is equivalent to "from 1 to 5" (5 not included)
[1:] is equivalent to "1 to end"
[len(a):] is equivalent to "from length of a to end"
Watch https://youtu.be/tKTZoB2Vjuk?t=41m40s at around 40:00 he starts explaining that.
Works with tuples and strings, too.
ANSWER 2
Score 22
slicing operator. http://docs.python.org/tutorial/introduction.html#strings and scroll down a bit
ANSWER 3
Score 15
a[len(a):] - This gets you the length of a to the end. It selects a range. If you reverse a[:len(a)] it will get you the beginning to whatever is len(a).