Skip to content

Instantly share code, notes, and snippets.

@tomdewildt
Created January 9, 2023 14:56
Show Gist options
  • Save tomdewildt/9e0d0e2f157dc51bebd5d77ffe1aaa38 to your computer and use it in GitHub Desktop.
Save tomdewildt/9e0d0e2f157dc51bebd5d77ffe1aaa38 to your computer and use it in GitHub Desktop.
Common functions for the python programming language
# Map number from one range to another range
def map(value, from_min, from_max, to_min, to_max):
return (value - from_min) * (to_max - to_min) / (from_max - from_min) + to_min;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment