Note that going back and forth between Python and ruby can be confusing
Array index number
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]
Where the pointer points
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]
Recommended Posts