Learning Scientific Programming with Python (2nd edition)
Q2.5.1: Normalizing a list
Question Q2.5.1
Write a python program to normalize a list of numbers, a
, such that its values lie between 0 and 1. Thus, for example, the list a = [2,4,10,6,8,4]
becomes [0.0, 0.25, 1.0, 0.5, 0.75, 0.25]
.
Hint: Use the built-ins min
and max
which return the minimum and maximum values in a sequence respectively; for example: min(a)
returns 2
in the above list.