[Tutor] scaling values

Hugo González Monteverde hugonz-lists at h-lab.net
Tue Mar 14 18:58:15 CET 2006


Hi Kevin,

Do you mean:?

1)take the highest value in the list hval, take the lowest value in the 
list lval

2) pass top and bottom NEW values for the list: ntop nbot

3) then build another list where hval is replaced by ntop, lval is 
replaced by nbot, and everything else is geometrically scaled in bewteen?

AFAIK, there is no such function in the standard lib (maybe someone 
knows better) but it is not hard to build such a function. Have you tried?

It would be something like:

def scaled(x, ntop, nbot)

See that you can use min(L) and max(L) to get lval and hval

Try it, and if you run into problems or have questions, don't hesitate 
to ask.

Hope that helps,

Hugo


More information about the Tutor mailing list