Python slicing is expressed using a colon (:). Example:
>>> a=[10,20,30,40,50,60,70,80,90,100,110]
>>> b=a[3:8:2]
>>> print(b)
[40, 60, 80]
>>>
Why use a colon (:)?
⇒ ** If you want to arrange meaningful (role) values, I think it's a colon (:). ** **
The following are similar usages. Excel example
=SUM(D3:D5)
The following is a similar explanation of wikipedia (Japanese) about the colon (:). https://ja.wikipedia.org/wiki/%E3%82%B3%E3%83%AD%E3%83%B3_(%E8%A8%98%E5%8F%B7)
Separate hours, minutes, and seconds of time and time. Its use as a time is specified in ISO 8601. 12:34:54 (12:34:54, 12 hours 34 minutes 54 seconds) 12:34 (12:34, 12 hours 34 minutes, 12 minutes 34 seconds)
Separate chapter numbers and section numbers for books (especially the Bible). For example, "John 1:15" is John 1:15, Gospel of John 1:15.
When expressing an IPv6 address in characters, use a colon to separate each 16 bits. A series of 0s is expressed as "::". For example 2001: db8 :: 1.
** I think I naturally chose the most appropriate colon (:). ** ** (Python may have some influence on not disliking the colon (:).)
Recommended Posts