Hang on...
RGB to Hex Color Converter
In this lab, you will write a Python function named get_hexcode()
that converts RGB (Red, Green, Blue) values into their hexadecimal color code representation. The function should take three parameters: red
, green
, and blue
, each ranging from 0 to 255, and return a string representing the color in hexadecimal format (#XXXXXX
).
Function Output
- The output should be a string starting with
#
followed by a six-character hexadecimal number. - Hexadecimal characters should be in uppercase.
Examples
-
Input:
get_hexcode(255, 0, 0)
Output:#FF0000
-
Input:
get_hexcode(0, 255, 255)
Output:#00FFFF
Your task is to ensure that the function accurately converts any given RGB values to the correct hexadecimal representation. Good luck!
Adding your container request
Getting your dedicated container
Connecting to your container
Setting up your editor
Finalizing your playground
TerminalEditorBrowser