import numpy as np
x1=np.arange(9,18)
print(x1) # [ 9 10 11 12 13 14 15 16 17]
x2=(2*x1) +8
print(x2) # [26 28 30 32 34 36 38 40 42]
x3=np.linspace(2,20,4)
print(x3) # [ 2. 8. 14. 20.]
x4=np.arange(2,21,3)
print(x4) # [ 2 5 8 11 14 17 20]
import numpy as np
x1=np.arange(9,18)
print(x1)
s1=x1.shape
y1=np.ones(s1)
print(y1)
Output
[ 9 10 11 12 13 14 15 16 17]
[1. 1. 1. 1. 1. 1. 1. 1. 1.]
import numpy as np
x1=np.arange(9,18)
print(x1)
s1=x1.shape
y1=np.ones(s1)
y1=np.random.randint(4,high=10,size=s1)
print(y1)
Output
[ 9 10 11 12 13 14 15 16 17]
[7 4 5 7 7 6 4 4 4]
Numpyones()
bincount()
arange()
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.