mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-26 09:21:00 +03:00
Fix omitting end / beginning in ranges (#2649)
This commit is contained in:
parent
d8a3184a73
commit
870e2fbf6d
@ -208,9 +208,9 @@ li[4] # Raises an IndexError
|
||||
# You can look at ranges with slice syntax.
|
||||
# (It's a closed/open range for you mathy types.)
|
||||
li[1:3] # => [2, 4]
|
||||
# Omit the beginning
|
||||
li[2:] # => [4, 3]
|
||||
# Omit the end
|
||||
li[2:] # => [4, 3]
|
||||
# Omit the beginning
|
||||
li[:3] # => [1, 2, 4]
|
||||
# Select every second entry
|
||||
li[::2] # =>[1, 4]
|
||||
|
Loading…
Reference in New Issue
Block a user