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
a[0]=1
The second element is: a[1]<--  index=1
a[1]=2
The third element is: a[2]<--  index=2
a[2]=3
The fourth element is: a[3]<--  index=3
a[3]=4
The fifth element is: a[4]<--  index=4
a[4]=5
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

([2,3,4])