You are reading a single comment by @Tijmen and its replies.
Click here to read the full conversation.
-
This is great, just doing the challenges is already good for my programming skills but info like this and things previously posted by @Greenbank are even better. Helps me move away from hacky solutions to proper solutions.
The slice syntax is
and you can omit any, so start defaults to zero, stop to -1 (which means the end, since negative indices count backwards), and stride defaults to 1.
grid[start]
just gives you the element at indexstart
(ie, the half-open interval[start,start+1)
in maths language),[start:stop]
gives you the sub-sequence/sub-string with default stride 1,[start::stride]
would give you everystride
'th element fromstart
to the end, etc.