Skip to content

Instantly share code, notes, and snippets.

@Sadamingh
Created September 6, 2020 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sadamingh/6476151f10d780c2d9f4b55a88953bfe to your computer and use it in GitHub Desktop.
Save Sadamingh/6476151f10d780c2d9f4b55a88953bfe to your computer and use it in GitHub Desktop.
def bound_value(value: float, min_value: float, max_value: float) -> float:
return min(max_value, max(value, min_value))
bound_value(235, min_value=0, max_value=255)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment