import numpy as np
a1 = np.array(5)
a2 = np.array(3)
a3 = a1 + a2
>>> 8
s = np.array(5)
x = s+3
>>> 8
v = np.array([1,2,3])
x = v[0]
print(v)
print(x)
print(v[1:])
>>> [1 2 3]
1
[2 3]
m = np.array([[1,2,3],[4,5,6],[7,8,9]])
print(m)
print(m[1][2])
>>>[[1 2 3]
[4 5 6]
[7 8 9]]
6
t = np.array([[[[1],[3]],[[2],[4]],[[5],[6]]],
[[[7],[8]],[[9],[10]],[[11],[12]]],
[[[13],[14]],[[15],[16]],[[17],[18]]]])
print(t.shape)
>>>(3, 3, 2, 1)
1. **Python's way**
values = [1,2,3,4,5]
values = [values[i]+5 for i in range(len((values)))]
print(values[0],'end')
print(range(len(values)))
print(values)
>>> 6 end
range(0, 5)
[6, 7, 8, 9, 10]
2. **Numpy's way **
values = [1,2,3,4,5]
values = np.array(values) + 5
>>>[ 6 7 8 9 10]