Skip to content

Instantly share code, notes, and snippets.

@BilHim
Created February 17, 2021 15:39
Show Gist options
  • Select an option

  • Save BilHim/30eec1d1efbabeda7f643f68469ec174 to your computer and use it in GitHub Desktop.

Select an option

Save BilHim/30eec1d1efbabeda7f643f68469ec174 to your computer and use it in GitHub Desktop.
def truncate(x):
'''makes sure returned value is between 0 and 255'''
return min(255, max(0, x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment