Created
February 21, 2024 07:16
-
-
Save guilyx/4fe0f950ecd9e8a91c04206011f7dde5 to your computer and use it in GitHub Desktop.
Python Clamp Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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