RGB to Hex Color Converter

Easy
4
62.7% Acceptance

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

  1. Input: get_hexcode(255, 0, 0)
    Output: #FF0000

  2. 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!