Skip to content

Instantly share code, notes, and snippets.

@guilyx
Created February 21, 2024 07:16
Show Gist options
  • Save guilyx/4fe0f950ecd9e8a91c04206011f7dde5 to your computer and use it in GitHub Desktop.
Save guilyx/4fe0f950ecd9e8a91c04206011f7dde5 to your computer and use it in GitHub Desktop.
Python Clamp Function
def clamp(value, min_value, max_value):
return max(min_value, min(max_value, value))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment