Assuming that I have three variables r, g, b
. If any of these variables are < 0
or > 255
, they are to be rounded to 0
and 255
respectively.
My unsophisticated knowledge of python would tell me to utilise a bunch of if-statements, which I think would be time-consuming and unnecessary. Is there any other method of doing this?