Important Notice:

Course Content
NumPy Basic in Python (Chapter-13) M3-R5
About Lesson

Array From Numerical Ranges:-

 

Np.arange:- arrange(0 returns an ndarray object containing evenly spaced values within a given range.

Syntax:- numpy.arange(start,stop,step,dtype)

import numpy as np

arr=np.arange(1,10,2)

print(arr)

Output

[1 3 5 7 9]

 

Conditional Selection

import numpy as np

arr=np.arange(1,20,1)

b=arr>10

print(arr[b])

Output

[11 12 13 14 15 16 17 18 19]

 

Multiply Number Printing

import numpy as np

arr=np.arange(1,5)

print(arr*2)

Output

[2 4 6 8]

 

 

 

 

 

 

error: Content is protected !!