Menu

gitpiper

num_to_range python Code Snippet in 2024

mathbeginner

Last Updated: 1 December 2024

Maps a number from one range to another range.

  • Return num mapped between outMin-outMax from inMin-inMax.
def num_to_range(num, inMin, inMax, outMin, outMax): return outMin + (float(num - inMin) / float(inMax - inMin) * (outMax - outMin))
num_to_range(5, 0, 10, 0, 100) # 50.0

python snippet similar to num_to_range For You in December 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️