What does 0 followed by fullstop mean in an array?

One of the labs has the following code line and I am wondering what the full stop means.
x_train = np.array([0., 1, 2, 3, 4, 5])

Also what would x_train[pos] contain?

It depends on what the value of “pos” is.

You can discover this yourself by adding the code “print(x_train[pos])” to that cell.

1 Like

Got it. Thank you.

print(f'pos is {pos}')
print(f'x_train[pos] is {x_train[pos]}')


For the first part of my question, what does a number followed by full stop mean?

Ah found it. It means it is a float.

But why is only the first element of x_train declared this way?

Sorry, I don’t know what you mean by “followed by a full stop”.


1 Like


Making the first element or any one of the elements float is sufficient for numpy to make the whole array float.


1 Like