a = np.array([1, 2, 3, 4, 5, 6, 7, 8])
#subelement 2-4
b = a[1:4]

Here we would like to get the second to the fourth sub-element of array a. Remember that indexing starts from zero. Therefore,
The first element is: a[0]<-- index=0
The second element is: a[1]<--  index=1
The third element is: a[2]<--  index=2
The fourth element is: a[3]<--  index=3
The fifth element is: a[4]<--  index=4
We can print the second to the fourth element without looping over the array. We can do that by using the syntax.

b = a[1:4]

were a is the array and in between the square brackets [] you type the start element with index (1) to (:) the last element index (4)(not included). the output should look like