Created
November 30, 2014 09:14
-
-
Save Qooh0/0a3141e1203da9e3b59b to your computer and use it in GitHub Desktop.
Python と ruby のスライス memo ref: http://qiita.com/Qooh0@github/items/5cf2b3ea869716dcaf5a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):014:0> a = [1, 2, 3, 4, 5] | |
=> [1, 2, 3, 4, 5] | |
irb(main):024:0> a[0..3] | |
=> [1, 2, 3, 4] | |
irb(main):018:0> a[1..3] | |
=> [2, 3, 4] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [3]: a | |
Out[3]: [1, 2, 3, 4, 5, 6, 7, 8, 9] | |
In [4]: a[0:3] | |
Out[4]: [1, 2, 3] | |
In [5]: a[1:3] | |
Out[5]: [2, 3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment