def __str__(self): """Returns the string value of the color object""" value = COLOR_NAMES.get(self.color.upper()) # if value: # return str(value) # else: # return "Unknown" return str(value) if value else "Unknown"
def __init__(self, color): self.color = color self.rgb = COLOR_NAMES.get(color.upper(), None)
def __str__(self): """Returns the string value of the color object""" return f"{self.rgb}" if self.color.upper() in COLOR_NAMES.keys( ) else "Unknown"