From a6fefe0f63991a772b9be91fe20dc6cf37ab5fa4 Mon Sep 17 00:00:00 2001 From: Md Farhan Sajid <87274221+Farhan-2222@users.noreply.github.com> Date: Sun, 2 Oct 2022 18:50:58 +0530 Subject: [PATCH] rgb-to-hex added --- scripts/RGB_To_Hexa/rgb-to-hex.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 scripts/RGB_To_Hexa/rgb-to-hex.py diff --git a/scripts/RGB_To_Hexa/rgb-to-hex.py b/scripts/RGB_To_Hexa/rgb-to-hex.py new file mode 100644 index 0000000..ec4ed5b --- /dev/null +++ b/scripts/RGB_To_Hexa/rgb-to-hex.py @@ -0,0 +1,10 @@ +def rgb_to_hex(rgb): + return '%02x%02x%02x' % rgb + + +print("Enter the value of RGB color in (X,Y,Z) format:") +X = int(input("Enter value of X: ")) +Y = int(input("Enter value of Y: ")) +Z = int(input("Enter value of Z: ")) +hex = rgb_to_hex((X, Y, Z)) +print("The hexadecimal value is: {}" .format(hex))