mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Merge pull request #30 from jeffcarp/master
Reverse "Omit the beginning" and "Omit the end" examples
This commit is contained in:
commit
823f5d2ab8
@ -134,9 +134,9 @@ except IndexError:
|
||||
# (It's a closed/open range for you mathy types.)
|
||||
li[1:3] #=> [2, 4]
|
||||
# Omit the beginning
|
||||
li[:3] #=> [1, 2, 4]
|
||||
# Omit the end
|
||||
li[2:] #=> [4, 3]
|
||||
# Omit the end
|
||||
li[:3] #=> [1, 2, 4]
|
||||
|
||||
# Remove arbitrary elements from a list with del
|
||||
del li[2] # li is now [1, 2, 3]
|
||||
|
Loading…
Reference in New Issue
Block a user