1def normalize(v):
2 norm = np.linalg.norm(v)
3 if norm == 0:
4 return v
5 return v / norm
6
1import numpy as np
2x= np.random.random((3,3))
3print("Original Array:")
4print(x)
5xmax, xmin = x.max(), x.min()
6x = (x - xmin)/(xmax - xmin)
7print("After normalization:")
8print(x)
9