mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-22 21:52:31 +03:00
Reverse "omit the beginning|end"
While reading I thought this might be a mistake (or I'm just going crazy).
This commit is contained in:
parent
3301f77062
commit
e2fe947b79
@ -134,9 +134,9 @@ except IndexError:
|
|||||||
# (It's a closed/open range for you mathy types.)
|
# (It's a closed/open range for you mathy types.)
|
||||||
li[1:3] #=> [2, 4]
|
li[1:3] #=> [2, 4]
|
||||||
# Omit the beginning
|
# Omit the beginning
|
||||||
li[:3] #=> [1, 2, 4]
|
|
||||||
# Omit the end
|
|
||||||
li[2:] #=> [4, 3]
|
li[2:] #=> [4, 3]
|
||||||
|
# Omit the end
|
||||||
|
li[:3] #=> [1, 2, 4]
|
||||||
|
|
||||||
# Remove arbitrary elements from a list with del
|
# Remove arbitrary elements from a list with del
|
||||||
del li[2] # li is now [1, 2, 3]
|
del li[2] # li is now [1, 2, 3]
|
||||||
|
Loading…
Reference in New Issue
Block a user