import numpy as np
a=np.arange(10)
print(a)
print(a[0:2])
print(a[2:5])
print(a[5:8])
print(a[7:9])
generates the following:
[0 1 2 3 4 5 6 7 8 9]
[0 1]
[2 3 4]
[5 6 7]
[7 8]
Why do print(a[0:2]) and print(a[7:9]) show arrays of only 2 elements?