Advertisement
skotoseme

normalize

Apr 24th, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. def normalize(points, height=10):
  2.     new_points = []
  3.     mini = min(points)
  4.     for point in points:
  5.         new_points.append(point-mini)
  6.     newer_points = []
  7.     maxi = max(new_points)
  8.     for point in new_points:
  9.         newer_points.append(point*height/maxi)
  10.     return newer_points
  11.  
  12. points=[-2,0,1]
  13.  
  14. print normalize(points)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement