21.7k views
5 votes
Create an array from 0 to 10 by steps of 0.5

1 Answer

0 votes

Answer:

#here is code in python

#import numpy library

import numpy as np

#create an array from 0 to 10 by steps of 0.5

ar=np.arange(0,10.5,0.5)

#print the array

print(ar)

Step-by-step explanation:

Import the numpy library as alias "np".Then np.arange() function will call with three parameter to create an array.Here first parameter is start and goes till second parameter -increment.Here 3rd parameter is increment.It will create the array and assign it to "ar".Print the array.

Output:

[ 0. 0.5 1. 1.5 2. 2.5 3. 3.5 4. 4.5 5.

5.5 6. 6.5 7. 7.5 8. 8.5 9. 9.5 10. ]

User YemSalat
by
6.2k points