normalise list python

>>> a = [2,4,10,6,8,4]
>>> amin, amax = min(a), max(a)
>>> for i, val in enumerate(a):
...     a[i] = (val-amin) / (amax-amin)
...
>>> a
[0.0, 0.25, 1.0, 0.5, 0.75, 0.25]

Here is what the above code is Doing:
1. We create a list of numbers.
2. We find the minimum and maximum values in the list.
3. We iterate over the list, and for each value we subtract the minimum value and divide by the difference between the maximum and minimum values.
4. We print the resulting list.

The output is a list of numbers between 0 and 1, where 1 represents the maximum value in the list, and 0 represents the minimum value.

This is a simple way to normalize data.