def fullRGB(rgb: int) -> str: """Left pad 0's to make the string of length 9.""" return str(rgb).zfill(9) def isGray(rgb: int) -> bool: """Return True if the RGB value passed is considered 'gray'.""" rgbStr = fullRGB(rgb) return (rgbStr[0:3] == rgbStr[3:6]) and (rgbStr[3:6] == rgbStr[6:9]) print("Testing isGray()...", end="") assert isGray(112112112) == True assert isGray(112112113) == False assert isGray(123195060) == False assert isGray(255255255) == True assert isGray(0) == True assert isGray(19019019) == True assert isGray(175112) == False print("Passed!")