Learn practical skills, build real-world projects, and advance your career
Created 3 years ago
1.
import numpy as np
x = np.array([1,2,3])
print(f'Given list : {list(x)}')
z = []
for i in x:
y = (i - x.min())/(x.max() - x.min())
z.append(y)
a = np.round(z, decimals = 4)
print(f'Output : {list(a)}')
Given list : [1, 2, 3]
Output : [0.0, 0.5, 1.0]