Example #1
0
 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"
Example #2
0
    def __init__(self, color):

        self.color = color
        self.rgb = COLOR_NAMES.get(color.upper(), None)
Example #3
0
 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"