numpy - arange: Why does following example not end at 10

Viewed 683

I am beginner in Python.Trying hands on to learn numpy.

import numpy as np
x = np.arange(0.5, 10.4, 0.8, int)

it outputs :

[ 0  1  2  3  4  5  6  7  8  9 10 11 12 ]

I was expecting it to return (as last item is 10.4):

[ 0  1  2  3  4  5  6  7  8  9 10 ]

Apart from above, if I execute this(Understood this example) :

x = np.arange(0.5, 10.4, 0.8)
print(x)

It prints :

[  0.5  1.3  2.1  2.9  3.7  4.5  5.3  6.1  6.9  7.7  8.5  9.3  10.1 ]
1 Answers
Related