I'm having a simple trouble but I don't know how to solve it.
This is my code, so far:
class CorRGB:
def __init__(self, red, green, blue):
self.r = min(1.0,red);
self.g = min(1.0,green);
self.b = min(1.0,blue);
def __repr__(self):
return str(self.r*255) + str(" ") + str(self.g) + str(" ") + str(self.b)
c1 = CorRGB(10.0, -4.0, 0.1)
print(str(c1))
So, if the r,g,b values are greater than 1.0, it has to return 1.0. And if the r,g,b values are lower than 0.0 it has to return 0.0. I have to use the min()
and max()
functions, but I can only work with one at a time, I need to use them both for the same argument.