Aug-19-2022, 08:36 PM
I have errors in my code, it is for converting RGB to Hex in python.
I already tried adding
def color(RGB): if RGB > 255: RGB = 255 elif RGB < 0: RGB = 0 RGB = hex(RGB)[2:].upper() if len(RGB)<2: RGB = '0'+RGB return RGB def rgb(r, g, b): return color(r)+color(g)+color(b)It shows for line 7. the following is thrown:
Error:TypeError: object of type 'int' has no len()
Does anyone have recommendations to help me fix this program?I already tried adding
str()
to len(RGB)<2:
with no successes.