10th Sep 2020, 5:27 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 4
try 1 digit value, you'll see why. or more obvious fail try pure black 0 0 0
10th Sep 2020, 5:01 PM
Rei
Rei - avatar
+ 3
you need to format the result hex so each value have 2 hex digit. as for now, inputting value of 10. will result in A, but it should be 0A so 10 10 10 will be AAA instead of 0A0A0A same with 0, inputting 0 will result in no value.
10th Sep 2020, 5:05 PM
Rei
Rei - avatar
+ 3
If you enter 15 15 15 the output is #fff which would mean an rgb value of 255 255 255. Instead you want an output like #0f0f0f. You need to check whether the number is smaller than 16 and if so add a '0' character to the hex string.
10th Sep 2020, 5:05 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
0
red = int(input()) blue = int(input()) green = int(input()) def hexadd(x, y, z): a = (hex(x))[2::] b = (hex(y))[2::] c = (hex(z))[2::] return ("#" + a + b + c) print(hexadd(red, blue, green))
8th Nov 2022, 8:22 PM
Hamish Zwain